worker: share GCP image only if the accounts list is not empty
Modify worker's job implementation to try to share GCP image only if the provided list of accounts is not empty. Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
parent
7de2011beb
commit
bbae190e99
1 changed files with 7 additions and 5 deletions
|
|
@ -315,11 +315,13 @@ func (impl *OSBuildJobImpl) Run(job worker.Job) error {
|
|||
}
|
||||
log.Printf("[GCP] 💿 Image URL: %s", g.ComputeImageURL(t.ImageName))
|
||||
|
||||
log.Printf("[GCP] 🔗 Sharing the image with: %+v", options.ShareWithAccounts)
|
||||
err = g.ComputeImageShare(t.ImageName, options.ShareWithAccounts)
|
||||
if err != nil {
|
||||
r = append(r, err)
|
||||
continue
|
||||
if len(options.ShareWithAccounts) > 0 {
|
||||
log.Printf("[GCP] 🔗 Sharing the image with: %+v", options.ShareWithAccounts)
|
||||
err = g.ComputeImageShare(t.ImageName, options.ShareWithAccounts)
|
||||
if err != nil {
|
||||
r = append(r, err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
targetResults = append(targetResults, target.NewGCPTargetResult(&target.GCPTargetResultOptions{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue