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

@ -465,7 +465,7 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error {
case *target.GCPTargetOptions:
ctx := context.Background()
g, err := impl.getGCP(nil)
g, err := impl.getGCP(options.Credentials)
if err != nil {
osbuildJobResult.JobError = clienterrors.WorkerClientError(clienterrors.ErrorInvalidConfig, err.Error())
return nil