#!/usr/bin/env bash # The release's software bill of materials: one CycloneDX JSON for the version, from the committed # lockfiles of the published modules (build-logic is a build tool and is not shipped). Made before # the blocking vulnerability check, so a failed release can still say what it would have shipped. # # scripts/release/sbom.sh set -euo pipefail root=$(git rev-parse --show-toplevel) output=${1:?usage: sbom.sh } mkdir -p "$(dirname "$output")" trivy=$("$root/scripts/tool.sh" trivy) cd "$root" "$trivy" fs --skip-version-check --format cyclonedx --skip-dirs build-logic --output "$output" . python3 -c 'import json,sys; d=json.load(open(sys.argv[1])); assert d.get("bomFormat")=="CycloneDX" and d.get("components"), "empty SBOM"; print("sbom:", len(d["components"]), "components")' "$output"