Weldr: support GCP upload target

Add support for importing the GCE image into GCP using Weldr API. The
credentials to be used can be specified in the upload settings and will
be then used by the worker to authenticate with GCP.

The GCP target credentials are passed to Weldr API as base64 encoded
content of the GCP credentials JSON file. The reason is that the JSON
file contains many values and its format could change in the future.
This way, the Weldr API does not rely on the credentials file content
format in any way.

Add a new test case for the GCP upload via Weldr and run it in CI.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2022-03-07 21:49:24 +01:00 committed by Tom Gundersen
parent 249661a948
commit ee285e5e8a
6 changed files with 398 additions and 12 deletions

View file

@ -6,7 +6,12 @@ type GCPTargetOptions struct {
Os string `json:"os"` // not exposed in cloudapi for now
Bucket string `json:"bucket"`
Object string `json:"object"`
ShareWithAccounts []string `json:"shareWithAccounts"`
ShareWithAccounts []string `json:"shareWithAccounts,omitempty"`
// If provided, these credentials are used by the worker to import the image
// to GCP. If not provided, the worker will try to authenticate using the
// credentials from worker's configuration.
Credentials []byte `json:"credentials,omitempty"`
}
func (GCPTargetOptions) isTargetOptions() {}