2021-12-11 22:21:51 -05:00
|
|
|
# Cataloging artifacts
|
|
|
|
|
2023-04-02 17:16:21 -03:00
|
|
|
> Since: v1.2
|
2022-09-11 16:54:51 -03:00
|
|
|
|
2022-09-17 00:13:09 -03:00
|
|
|
A Software Bill of Materials (SBOM) is a description of the components that make
|
|
|
|
up a software artifact.
|
2021-12-11 22:21:51 -05:00
|
|
|
|
2023-04-30 00:02:38 +00:00
|
|
|
GoReleaser can create one or more SBOMs for any artifacts generated by
|
|
|
|
GoReleaser.
|
2021-12-11 22:21:51 -05:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
2022-09-17 00:13:09 -03:00
|
|
|
The artifact cataloging step can analyze one or more artifacts generated by
|
2023-04-30 00:02:38 +00:00
|
|
|
GoReleaser and output one or more SBOM files into the dist directory.
|
2021-12-11 22:21:51 -05:00
|
|
|
|
2022-09-17 00:13:09 -03:00
|
|
|
The default is configured to create an SBOM for each binary produced with
|
|
|
|
[Syft](https://github.com/anchore/syft). To enable artifact cataloging just add:
|
2021-12-11 22:21:51 -05:00
|
|
|
|
|
|
|
```yaml
|
|
|
|
# .goreleaser.yml
|
|
|
|
sboms:
|
|
|
|
- artifacts: archive
|
|
|
|
```
|
|
|
|
|
|
|
|
To customize the artifact cataloging pipeline you can use the following options:
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
# .goreleaser.yml
|
|
|
|
sboms:
|
|
|
|
-
|
|
|
|
# ID of the sbom config, must be unique.
|
|
|
|
#
|
2023-04-02 17:16:21 -03:00
|
|
|
# Default: 'default'
|
2021-12-11 22:21:51 -05:00
|
|
|
id: foo
|
|
|
|
|
2023-04-02 17:16:21 -03:00
|
|
|
# List of names of the SBOM documents created at this step
|
2022-09-17 00:13:09 -03:00
|
|
|
# (relative to the dist dir).
|
2021-12-11 22:21:51 -05:00
|
|
|
#
|
|
|
|
# Each element configured is made available as variables. For example:
|
|
|
|
# documents: ["foo", "bar"]
|
|
|
|
#
|
|
|
|
# would make the following variables that can be referenced as template keys:
|
|
|
|
# document0: "foo"
|
|
|
|
# document1: "bar"
|
|
|
|
#
|
2022-09-17 00:13:09 -03:00
|
|
|
# Note that multiple sbom values are only allowed if the value of
|
|
|
|
# "artifacts" is "any".
|
2023-04-02 17:16:21 -03:00
|
|
|
#
|
|
|
|
# Default:
|
|
|
|
# When "binary": ["{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}.sbom"]
|
|
|
|
# When "any": []
|
|
|
|
# Otherwise: ["{{ .ArtifactName }}.sbom"]
|
|
|
|
# Templates: allowed
|
2021-12-11 22:21:51 -05:00
|
|
|
documents:
|
|
|
|
- "${artifact}.spdx.sbom"
|
|
|
|
|
|
|
|
# Path to the SBOM generator command
|
|
|
|
#
|
|
|
|
# Note: the process CWD will be set to the same location as "dist"
|
|
|
|
#
|
2023-04-02 17:16:21 -03:00
|
|
|
# Default: 'syft'
|
2021-12-11 22:21:51 -05:00
|
|
|
cmd: syft
|
|
|
|
|
2023-04-02 17:16:21 -03:00
|
|
|
# Command line arguments for the command
|
2021-12-11 22:21:51 -05:00
|
|
|
#
|
2023-04-02 17:16:21 -03:00
|
|
|
# Default: ["$artifact", "--file", "$document", "--output", "spdx-json"]
|
|
|
|
# Templates: allowed
|
2021-12-11 22:21:51 -05:00
|
|
|
args: ["$artifact", "--file", "$sbom", "--output", "spdx-json"]
|
|
|
|
|
2022-09-17 00:13:09 -03:00
|
|
|
# List of environment variables that will be passed to the SBOM command as
|
|
|
|
# well as the templates.
|
2021-12-11 22:21:51 -05:00
|
|
|
#
|
2023-04-02 17:16:21 -03:00
|
|
|
# Default: [ "SYFT_FILE_METADATA_CATALOGER_ENABLED=true" ]
|
2021-12-11 22:21:51 -05:00
|
|
|
env:
|
|
|
|
- FOO=bar
|
|
|
|
- HONK=honkhonk
|
|
|
|
|
|
|
|
# Which artifacts to catalog
|
|
|
|
#
|
2022-09-17 00:13:09 -03:00
|
|
|
# any: let the SBOM tool decide what artifacts available in the cwd
|
|
|
|
# should be cataloged
|
2021-12-11 22:21:51 -05:00
|
|
|
# source: source archive
|
|
|
|
# package: linux packages (deb, rpm, apk)
|
|
|
|
# archive: archives from archive pipe
|
|
|
|
# binary: binaries output from the build stage
|
|
|
|
#
|
2023-04-02 17:16:21 -03:00
|
|
|
# Default: 'archive'
|
2021-12-11 22:21:51 -05:00
|
|
|
artifacts: archive
|
|
|
|
|
|
|
|
# IDs of the artifacts to catalog.
|
|
|
|
#
|
|
|
|
# If `artifacts` is "source" or "any" then this fields has no effect.
|
|
|
|
ids:
|
|
|
|
- foo
|
|
|
|
- bar
|
|
|
|
```
|
|
|
|
|
|
|
|
### Available variable names
|
|
|
|
|
2023-04-02 17:16:21 -03:00
|
|
|
These environment variables might be available in the fields that are accept
|
|
|
|
templates:
|
2021-12-11 22:21:51 -05:00
|
|
|
|
2022-09-17 00:13:09 -03:00
|
|
|
- `${artifact}`: the path to the artifact that will be cataloged (unless
|
|
|
|
"artifacts" config item is "any")
|
|
|
|
- `${artifactID}`: the ID of the artifact that will be cataloged (unless
|
|
|
|
"artifacts" config item is "any")
|
|
|
|
- `${document}`: the SBOM filename generated (corresponds to `${document0}` if
|
|
|
|
the "artifacts" config item is "any")
|
|
|
|
- `${document#}`: the SBOM filenames generated, where `#` corresponds to the
|
|
|
|
list index under the "documents" config item (e.g. `${document0}`)
|
2021-12-11 22:21:51 -05:00
|
|
|
|
|
|
|
## Limitations
|
|
|
|
|
2023-04-30 00:02:38 +00:00
|
|
|
Container images generated by GoReleaser are not available to be cataloged by
|
2022-09-17 00:13:09 -03:00
|
|
|
the SBOM tool.
|
2021-12-11 22:21:51 -05:00
|
|
|
|