feat(sbom): add a dedicated sbom command#1799
Conversation
pkg/commands/app.go
Outdated
| Flags: []cli.Flag{ | ||
| &formatFlag, | ||
| &outputFlag, | ||
| &exitCodeFlag, |
There was a problem hiding this comment.
Looks like sbom doesn't need --exit-code since this option makes the job fail when critical vulnerabilities are found.
pkg/commands/artifact/sbom.go
Outdated
|
|
||
| func analyzeArtifactPath(artifactPath string) (ArtifactType, string) { | ||
| // The user can specify the input artifact type by using the "<artifact-type>:" prefix before the artifact path | ||
| // e.g docker:ubuntu, package:/path/to/express |
There was a problem hiding this comment.
| // e.g docker:ubuntu, package:/path/to/express | |
| // e.g docker:ubuntu, dir:/path/to/express |
pkg/commands/app.go
Outdated
| ArgsUsage: "artifact", | ||
| Usage: "generate sbom for an artifact", | ||
| Action: artifact.SbomRun, |
There was a problem hiding this comment.
In addition to usage, we may want to add a description since this subcommand is a bit complex.
| ArgsUsage: "artifact", | |
| Usage: "generate sbom for an artifact", | |
| Action: artifact.SbomRun, | |
| ArgsUsage: "ARTIFACT", | |
| Usage: "generate sbom for an artifact", | |
| Description: fmt.Sprintf(`"ARTIFACT" uses a "transport":"details" format. | |
| Supported transports: | |
| %s | |
| `, artifact.ArtifactTypes.String()), |
pkg/commands/artifact/sbom.go
Outdated
| type ArtifactType string | ||
|
|
||
| const ( | ||
| DockerImageArtifact ArtifactType = "docker" |
There was a problem hiding this comment.
Trivy also supports Podman and we're trying to add support for Containerd. How about image?
| DockerImageArtifact ArtifactType = "docker" | |
| ContainerImageArtifact ArtifactType = "image" |
…e changes, remove unnecessary flag
pkg/commands/app.go
Outdated
| Supported types: %s`, artifact.ArtifactTypes), | ||
| Action: artifact.SbomRun, | ||
| Flags: []cli.Flag{ | ||
| &formatFlag, |
There was a problem hiding this comment.
table and template don't make sense. We should restrict formats that can be specified.
docs/advanced/sbom/cyclonedx.md
Outdated
| </details> | ||
|
|
||
| !!! caution | ||
| It doesn't support vulnerabilities yet, but installed packages. |
There was a problem hiding this comment.
This tab is required.
https://squidfunk.github.io/mkdocs-material/reference/admonitions/#usage
docs/getting-started/cli/sbom.md
Outdated
| @@ -0,0 +1,21 @@ | |||
| # Sbom | |||
There was a problem hiding this comment.
nit
| # Sbom | |
| # SBOM |
mkdocs.yml
Outdated
| - Repository: getting-started/cli/repo.md | ||
| - Client: getting-started/cli/client.md | ||
| - Server: getting-started/cli/server.md | ||
| - Sbom: getting-started/cli/sbom.md |
There was a problem hiding this comment.
| - Sbom: getting-started/cli/sbom.md | |
| - SBOM: getting-started/cli/sbom.md |
597dab3 to
19a4d1b
Compare
|
Thanks |
|
Thank you @tamirkiviti13 ! |
Co-authored-by: knqyf263 <knqyf263@gmail.com>
Description
This PR adds a new dedicated SBOM generation subcommand -
trivy sbom.Related issues