Skip to content

Commit

Permalink
log when creating sboms
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Abro <[email protected]>
  • Loading branch information
AustinAbro321 committed Jan 17, 2025
1 parent cfe1d2e commit f6b1f06
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/internal/packager2/layout/sbom.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (

"github.com/zarf-dev/zarf/src/api/v1alpha1"
"github.com/zarf-dev/zarf/src/config"
"github.com/zarf-dev/zarf/src/pkg/logger"
"github.com/zarf-dev/zarf/src/pkg/transform"
"github.com/zarf-dev/zarf/src/pkg/utils"
)
Expand All @@ -42,6 +43,7 @@ var viewerAssets embed.FS
var transformRegex = regexp.MustCompile(`(?m)[^a-zA-Z0-9\.\-]`)

func generateSBOM(ctx context.Context, pkg v1alpha1.ZarfPackage, buildPath string, images []transform.Image) error {
l := logger.From(ctx)
outputPath, err := utils.MakeTempDir(config.CommonOptions.TempDirectory)
if err != nil {
return err
Expand Down Expand Up @@ -73,6 +75,7 @@ func generateSBOM(ctx context.Context, pkg v1alpha1.ZarfPackage, buildPath strin
if err != nil {
return err
}
l.Info("creating image SBOMs", "reference", refInfo.Reference)
err = createSBOMViewerAsset(outputPath, refInfo.Reference, b, jsonList)
if err != nil {
return err
Expand Down Expand Up @@ -147,6 +150,7 @@ func createImageSBOM(ctx context.Context, cachePath, outputPath string, img v1.I
}

func createFileSBOM(ctx context.Context, component v1alpha1.ZarfComponent, outputPath, buildPath string) ([]byte, error) {
l := logger.From(ctx)
tmpDir, err := utils.MakeTempDir(config.CommonOptions.TempDirectory)
if err != nil {
return nil, err
Expand Down Expand Up @@ -192,6 +196,7 @@ func createFileSBOM(ctx context.Context, component v1alpha1.ZarfComponent, outpu
catalog := pkg.NewCollection()
relationships := []artifact.Relationship{}
for _, sbomFile := range sbomFiles {
l.Info("creating file SBOMs", "file", sbomFile)
fileSrc, err := filesource.NewFromPath(sbomFile)
if err != nil {
return nil, err
Expand Down

0 comments on commit f6b1f06

Please sign in to comment.