@@ -2,6 +2,7 @@ package build
22
33import (
44 "context"
5+ "errors"
56 "fmt"
67 "os"
78 "strconv"
@@ -38,6 +39,7 @@ import (
3839 "github.com/werf/werf/v2/pkg/telemetry"
3940 "github.com/werf/werf/v2/pkg/util/parallel"
4041 "github.com/werf/werf/v2/pkg/werf"
42+ "github.com/werf/werf/v2/pkg/werf/global_warnings"
4143)
4244
4345type BuildPhaseOptions struct {
@@ -237,7 +239,8 @@ func (phase *BuildPhase) convergeSbomByImagesSets(ctx context.Context) error {
237239 }
238240
239241 if err := parallel .DoTasks (ctx , len (names ), parallel.DoTasksOptions {
240- MaxNumberOfWorkers : int (phase .Conveyor .ParallelTasksLimit ),
242+ MaxNumberOfWorkers : int (phase .Conveyor .ParallelTasksLimit ),
243+ InitDockerCLIForEachWorker : true ,
241244 }, func (ctx context.Context , taskId int ) error {
242245 name := names [taskId ]
243246 images := imagesByName [name ]
@@ -1445,7 +1448,8 @@ func (phase *BuildPhase) collectBaseImageSbom(ctx context.Context, img *image.Im
14451448 }
14461449
14471450 if img .GetBaseImageReference () == "" {
1448- return nil , fmt .Errorf ("unable to collect base image sbom for image %q: empty base image reference" , name )
1451+ global_warnings .GlobalWarningLn (ctx , fmt .Sprintf ("SBOM for base image of %q is not available: empty base image reference" , name ))
1452+ return nil , nil
14491453 }
14501454
14511455 var baseImageInfo * imagePkg.Info
@@ -1465,11 +1469,16 @@ func (phase *BuildPhase) collectBaseImageSbom(ctx context.Context, img *image.Im
14651469 }
14661470
14671471 if baseImageInfo == nil {
1468- return nil , fmt .Errorf ("unable to collect base image sbom for image %q: base image info not available" , name )
1472+ global_warnings .GlobalWarningLn (ctx , fmt .Sprintf ("SBOM for base image (from) of %q is not available: base image info not available" , name ))
1473+ return nil , nil
14691474 }
14701475
14711476 baseImageSbom , err := phase .sbomStep .GetImageBOM (ctx , name , img .GetBaseImageReference (), baseImageInfo )
14721477 if err != nil {
1478+ if errors .Is (err , ErrSbomNotAvailable ) {
1479+ global_warnings .GlobalWarningLn (ctx , fmt .Sprintf ("SBOM for base image (from) %q of %q is not available: %s" , img .GetBaseImageReference (), name , err ))
1480+ return nil , nil
1481+ }
14731482 return nil , fmt .Errorf ("unable to get base image sbom with ref %s: %w" , img .GetBaseImageReference (), err )
14741483 }
14751484
@@ -1503,11 +1512,16 @@ func (phase *BuildPhase) collectImportImageSboms(ctx context.Context, img *image
15031512 }
15041513
15051514 if importImageInfo == nil {
1506- return nil , fmt .Errorf ("unable to collect import image sbom for %q on platform %q: image info not available" , importInfo .ImageName , img .TargetPlatform )
1515+ global_warnings .GlobalWarningLn (ctx , fmt .Sprintf ("SBOM for imported image (import) %q of %q on platform %q is not available: image info not available" , importInfo .ImageName , name , img .TargetPlatform ))
1516+ continue
15071517 }
15081518
15091519 importImageSbom , err := phase .sbomStep .GetImageBOM (ctx , name , importInfo .ImageName , importImageInfo )
15101520 if err != nil {
1521+ if errors .Is (err , ErrSbomNotAvailable ) {
1522+ global_warnings .GlobalWarningLn (ctx , fmt .Sprintf ("SBOM for imported image (import) %q of %q is not available: %s" , importInfo .ImageName , name , err ))
1523+ continue
1524+ }
15111525 return nil , fmt .Errorf ("unable to get import image sbom for %q: %w" , importInfo .ImageName , err )
15121526 }
15131527 importImageSboms = append (importImageSboms , importImageSbom )
0 commit comments