worker/gcp: return error if job doesn't specify object key

The object key is required in order to upload the image to GCP. Return
an error if it is not set.
This commit is contained in:
Tomáš Hozza 2022-10-03 14:31:40 +02:00 committed by Ondřej Budai
parent 809107cd45
commit dd36fce63c

View file

@ -580,6 +580,11 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error {
break
}
if targetOptions.Object == "" {
targetResult.TargetError = clienterrors.WorkerClientError(clienterrors.ErrorInvalidTargetConfig, "No GCP object key provided", nil)
break
}
bucket := targetOptions.Bucket
if bucket == "" {
bucket = impl.GCPConfig.Bucket