Skip to content

Commit

Permalink
add comments to better describe sbom check
Browse files Browse the repository at this point in the history
  • Loading branch information
d33bs committed Nov 5, 2024
1 parent 67ba013 commit 90fe618
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ repos:
args: ["--float-to-top"]
- repo: local
hooks:
# checks language use throughout the project.
- id: vale.sh
name: vale.sh writing checks
entry: poetry run poe vale-checks
language: system
pass_filenames: false
# checks the almanack sbom file.
- id: syft-sbom-check
name: Syft SBOM Check
entry: poetry run poe sbom-checks
Expand Down
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ if [ $(echo "$output" | wc -l) -gt 1 ]; then
echo "$output"; exit 1;
fi
"""
# run check on the sbom to see if it needs to be updated
# Run check on the sbom to see if it needs to be updated.
# We create a new sbom from the existing source for the almanack,
# then compare it to the current sbom.json for differences.
# If the sbom is missing or differs, we throw a non-zero exit.
# Intended to be run through pre-commmit as a check on this repo.
sbom-checks.shell = """
# Generate SBOM using Anchore Syft
docker run --rm -v $(pwd):/workspace anchore/syft:latest scan dir:/workspace --output spdx-json > sbom-new.json
Expand All @@ -140,7 +144,7 @@ docker run --rm -v $(pwd):/workspace anchore/syft:latest scan dir:/workspace --o
if [ ! -f sbom.json ]; then
echo "No existing SBOM found. Creating baseline SBOM."
mv sbom-new.json sbom.json
exit 0
exit 1
fi
# Use sbomdiff to check for changes
Expand Down

0 comments on commit 90fe618

Please sign in to comment.