diff --git a/cmd/stacker/bom.go b/cmd/stacker/bom.go index be8457d2..10390ead 100644 --- a/cmd/stacker/bom.go +++ b/cmd/stacker/bom.go @@ -90,18 +90,19 @@ func doBomBuild(ctx *cli.Context) error { } func doBomVerify(ctx *cli.Context) error { - if ctx.Args().Len() != 4 { + if ctx.Args().Len() != 5 { return errors.Errorf("wrong number of args") } dest := ctx.Args().Get(0) - name := ctx.Args().Get(1) - author := ctx.Args().Get(2) - org := ctx.Args().Get(3) + namespace := ctx.Args().Get(1) + name := ctx.Args().Get(2) + author := ctx.Args().Get(3) + org := ctx.Args().Get(4) // first merge all individual sbom artifacts that may have been generated iDir := types.InternalStackerDir - if err := bom.MergeDocuments(iDir+"/artifacts", name, author, org, dest); err != nil { + if err := bom.MergeDocuments(iDir+"/artifacts", namespace, name, author, org, dest); err != nil { return err } diff --git a/go.mod b/go.mod index 4517d702..727af294 100644 --- a/go.mod +++ b/go.mod @@ -286,5 +286,5 @@ require ( replace ( github.com/opencontainers/umoci => github.com/project-stacker/umoci v0.0.0-20240122204034-cb3aca58b2ec - stackerbuild.io/stacker-bom => github.com/project-stacker/stacker-bom v0.0.6-0.20240118174508-52fb507e9d2e + stackerbuild.io/stacker-bom => github.com/project-stacker/stacker-bom v0.0.6-0.20240125170016-363073df9862 ) diff --git a/go.sum b/go.sum index 16d0c193..154b9bc8 100644 --- a/go.sum +++ b/go.sum @@ -799,6 +799,8 @@ github.com/proglottis/gpgme v0.1.3 h1:Crxx0oz4LKB3QXc5Ea0J19K/3ICfy3ftr5exgUK1AU github.com/proglottis/gpgme v0.1.3/go.mod h1:fPbW/EZ0LvwQtH8Hy7eixhp1eF3G39dtx7GUN+0Gmy0= github.com/project-stacker/stacker-bom v0.0.6-0.20240118174508-52fb507e9d2e h1:BYJ7UPVH+4YErCyfZGdUqMzp2wBeVGq26wNuohOEn4E= github.com/project-stacker/stacker-bom v0.0.6-0.20240118174508-52fb507e9d2e/go.mod h1:iKH3F0e8i3eNB6JbtGKv8qpgDSfUDUn+t8KoQ9Wf6pE= +github.com/project-stacker/stacker-bom v0.0.6-0.20240125170016-363073df9862 h1:SFnn7tNrursXkAfIltfETcwVbX7mtM6qxnehoEbfgZ4= +github.com/project-stacker/stacker-bom v0.0.6-0.20240125170016-363073df9862/go.mod h1:iKH3F0e8i3eNB6JbtGKv8qpgDSfUDUn+t8KoQ9Wf6pE= github.com/project-stacker/umoci v0.0.0-20240122204034-cb3aca58b2ec h1:59Z20xRtwyzB7D/CRsueFkrIT1vJwWVtMe0riQb3kiE= github.com/project-stacker/umoci v0.0.0-20240122204034-cb3aca58b2ec/go.mod h1:XUXUpCpA/Y8aJWezK1i8o4WDR0Y/vhMcWg+FUNQkKMQ= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= diff --git a/pkg/types/layer.go b/pkg/types/layer.go index d45b4c05..5824f487 100644 --- a/pkg/types/layer.go +++ b/pkg/types/layer.go @@ -69,8 +69,9 @@ type Package struct { } type Bom struct { - Generate bool `yaml:"generate" json:"generate"` - Packages []Package `yaml:"packages" json:"packages,omitempty"` + Generate bool `yaml:"generate" json:"generate"` + Namespace string `yaml:"namespace" json:"namespace"` + Packages []Package `yaml:"packages" json:"packages,omitempty"` } func getStringOrStringSlice(data interface{}, xform func(string) ([]string, error)) ([]string, error) { diff --git a/test/bom.bats b/test/bom.bats index b5358de4..8a5fb7ce 100644 --- a/test/bom.bats +++ b/test/bom.bats @@ -17,6 +17,7 @@ bom-parent: url: $CENTOS_OCI bom: generate: true + namespace: "https://test.io/artifacts" packages: - name: pkg1 version: 1.0.0 @@ -75,6 +76,7 @@ bom-parent: url: $CENTOS_OCI bom: generate: true + namespace: "https://test.io/artifacts" packages: - name: pkg1 version: 1.0.0 @@ -115,6 +117,7 @@ bom-child: tag: bom-parent bom: generate: true + namespace: "https://test.io/artifacts" packages: - name: pkg3 version: 1.0.0 @@ -163,6 +166,7 @@ bom-alpine: url: $ALPINE_OCI bom: generate: true + namespace: "https://test.io/artifacts" packages: - name: pkg1 version: 1.0.0