Skip to content

Commit

Permalink
pkg/cli: add --sbom-path option for outputting CycloneDX SBOMs
Browse files Browse the repository at this point in the history
  • Loading branch information
kaniini committed Mar 4, 2022
1 parent 1370c07 commit 3dfb333
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/cli/build-minirootfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
func BuildMinirootFS() *cobra.Command {
var useProot bool
var buildDate string
var sbomPath string

cmd := &cobra.Command{
Use: "build-minirootfs",
Expand All @@ -40,12 +41,14 @@ func BuildMinirootFS() *cobra.Command {
build.WithTarball(args[1]),
build.WithProot(useProot),
build.WithBuildDate(buildDate),
build.WithSBOM(sbomPath),
)
},
}

cmd.Flags().BoolVar(&useProot, "use-proot", false, "use proot to simulate privileged operations")
cmd.Flags().StringVar(&buildDate, "build-date", "", "date used for the timestamps of the files inside the image")
cmd.Flags().StringVar(&sbomPath, "sbom-path", "", "generate an SBOM")

return cmd
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/cli/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
func Build() *cobra.Command {
var useProot bool
var buildDate string
var sbomPath string

cmd := &cobra.Command{
Use: "build",
Expand All @@ -45,12 +46,14 @@ command, e.g.
build.WithConfig(args[0]),
build.WithProot(useProot),
build.WithBuildDate(buildDate),
build.WithSBOM(sbomPath),
)
},
}

cmd.Flags().BoolVar(&useProot, "use-proot", false, "use proot to simulate privileged operations")
cmd.Flags().StringVar(&buildDate, "build-date", "", "date used for the timestamps of the files inside the image")
cmd.Flags().StringVar(&sbomPath, "sbom-path", "", "generate an SBOM")

return cmd
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/cli/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func Publish() *cobra.Command {
var imageRefs string
var useProot bool
var buildDate string
var sbomPath string

cmd := &cobra.Command{
Use: "publish",
Expand All @@ -46,6 +47,7 @@ in a keychain.`,
build.WithProot(useProot),
build.WithTags(args[1:]...),
build.WithBuildDate(buildDate),
build.WithSBOM(sbomPath),
)
if err != nil {
return err
Expand All @@ -57,6 +59,7 @@ in a keychain.`,
cmd.Flags().StringVar(&imageRefs, "image-refs", "", "path to file where a list of the published image references will be written")
cmd.Flags().BoolVar(&useProot, "use-proot", false, "use proot to simulate privileged operations")
cmd.Flags().StringVar(&buildDate, "build-date", "", "date used for the timestamps of the files inside the image")
cmd.Flags().StringVar(&sbomPath, "sbom-path", "", "generate an SBOM")

return cmd
}
Expand Down

0 comments on commit 3dfb333

Please sign in to comment.