diff --git a/cmd/image-builder/main.go b/cmd/image-builder/main.go index 43af781..14bb9fc 100644 --- a/cmd/image-builder/main.go +++ b/cmd/image-builder/main.go @@ -133,18 +133,12 @@ func cmdManifestWrapper(cmd *cobra.Command, args []string, w io.Writer, archChec } } - var extraArtifacts []string - - if withSBOM { - extraArtifacts = append(extraArtifacts, "sbom") - } - opts := &manifestOptions{ - OutputDir: outputDir, - BlueprintPath: blueprintPath, - Ostree: ostreeImgOpts, - RpmDownloader: rpmDownloader, - ExtraArtifacts: extraArtifacts, + OutputDir: outputDir, + BlueprintPath: blueprintPath, + Ostree: ostreeImgOpts, + RpmDownloader: rpmDownloader, + WithSBOM: withSBOM, } err = generateManifest(dataDir, img, w, opts) return img, err diff --git a/cmd/image-builder/manifest.go b/cmd/image-builder/manifest.go index eb8fc83..7a4ab0c 100644 --- a/cmd/image-builder/manifest.go +++ b/cmd/image-builder/manifest.go @@ -4,7 +4,6 @@ import ( "io" "os" "path/filepath" - "slices" "github.com/osbuild/images/pkg/distro" "github.com/osbuild/images/pkg/imagefilter" @@ -16,11 +15,11 @@ import ( ) type manifestOptions struct { - OutputDir string - BlueprintPath string - Ostree *ostree.ImageOptions - RpmDownloader osbuild.RpmDownloader - ExtraArtifacts []string + OutputDir string + BlueprintPath string + Ostree *ostree.ImageOptions + RpmDownloader osbuild.RpmDownloader + WithSBOM bool } func sbomWriter(outputDir, filename string, content io.Reader) error { @@ -46,7 +45,7 @@ func generateManifest(dataDir string, img *imagefilter.Result, output io.Writer, Output: output, RpmDownloader: opts.RpmDownloader, } - if slices.Contains(opts.ExtraArtifacts, "sbom") { + if opts.WithSBOM { outputDir := opts.OutputDir if outputDir == "" { outputDir = outputNameFor(img)