-
Notifications
You must be signed in to change notification settings - Fork 403
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate SPDX SBOM at release time (#538)
* Add bom generation script This commit adds a script in scripts/sbom.sh that generates the SBOM for the release adding three kinds of elements to it: 1. The source code with full dependencies 2. The tarball distrubutions written in _dist 3. The container image The SBOM is written into the _dist directory. Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]> * Generate SBOM from build workflow This commit modifies the build pipeline to generate an SPDX SBOM describing the release. It uses the new bom-installer action to install the Kubernetes SBOM Tool into the runner and calls the scripts/sbom.sh script which handles the generation. Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]> * Modify release pipeline to properly include SBOM Signed-off-by: Josh Dolitsky <[email protected]> Co-authored-by: Josh Dolitsky <[email protected]>
- Loading branch information
Showing
5 changed files
with
70 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
: ${VERSION:?"VERSION environment variable is not set"} | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
cd $DIR/../ | ||
mkdir -p ./_dist/ | ||
pushd ./_dist/ | ||
|
||
# Initialize the configuration file | ||
cat << EOF > .sbom.yaml | ||
--- | ||
namespace: https://get.helm.sh/chartmuseum-${RELEASE}.spdx | ||
license: Apache-2.0 | ||
name: ChartMuseum | ||
artifacts: | ||
- type: directory | ||
source: .. | ||
EOF | ||
|
||
for file in $(ls *.{gz,zip}); | ||
do echo "Adding ${file} to SBOM" | ||
echo " - type: file" >> .sbom.yaml | ||
echo " source: ${file}" >> .sbom.yaml | ||
done | ||
|
||
echo "Adding image ghcr.io/helm/chartmuseum:${VERSION}" | ||
echo " - type: image" >> .sbom.yaml | ||
echo " source: ghcr.io/helm/chartmuseum:${VERSION}" >> .sbom.yaml | ||
|
||
echo "Wrote configuration file:" | ||
cat .sbom.yaml | ||
|
||
bom generate -c .sbom.yaml -o chartmuseum-${VERSION}.spdx | ||
|
||
rm .sbom.yaml | ||
popd | ||
echo "SBOM written to _dist/chartmuseum-${VERSION}.spdx" |