Skip to content

Commit 22ff8d5

Browse files
committed
Add GH workflow to generate SBOM with OSV-Scanner #1730
Signed-off-by: tdruez <[email protected]>
1 parent c2f46df commit 22ff8d5

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Generate SBOM with OSV-Scanner and load into ScanCode.io
2+
3+
# This workflow:
4+
# 1. Generates a CycloneDX SBOM for a container image using OSV-Scanner.
5+
# 2. Uploads the SBOM as a GitHub artifact for future inspection.
6+
# 3. Loads the SBOM into ScanCode.io for further analysis.
7+
# 4. Runs assertions to verify that the SBOM was properly processed in ScanCode.io.
8+
#
9+
# It runs on demand, and once a week (scheduled).
10+
11+
# https://google.github.io/osv-scanner/github-action/#github-action
12+
13+
on:
14+
workflow_dispatch:
15+
schedule:
16+
# Run once a week (every 7 days) at 00:00 UTC on Sunday
17+
- cron: "0 0 * * 0"
18+
pull_request:
19+
push:
20+
branches:
21+
- main
22+
23+
permissions:
24+
contents: read
25+
26+
env:
27+
IMAGE_REFERENCE: "python:3.13.0-slim"
28+
29+
jobs:
30+
generate-and-load-sbom:
31+
runs-on: ubuntu-24.04
32+
steps:
33+
- name: Generate CycloneDX SBOM with OSV-Scanner
34+
uses: "google/osv-scanner-action/.github/workflows/[email protected]"
35+
with:
36+
scan-args: image ${{ env.IMAGE_REFERENCE }}
37+
38+
# - name: Upload SBOM as GitHub Artifact
39+
# uses: actions/upload-artifact@v4
40+
# with:
41+
# name: osv-sbom-report
42+
# path: "osv-grype-sbom.cdx.json"
43+
# retention-days: 20
44+
#
45+
# - name: Import SBOM into ScanCode.io
46+
# uses: aboutcode-org/scancode-action@main
47+
# with:
48+
# pipelines: "load_sbom"
49+
# inputs-path: "osv-grype-sbom.cdx.json"
50+
#
51+
# - name: Verify SBOM Analysis Results in ScanCode.io
52+
# shell: bash
53+
# run: |
54+
# scanpipe shell --command "from scanpipe.models import DiscoveredPackage, DiscoveredDependency; package_manager = DiscoveredPackage.objects; assert package_manager.count() > 3200; assert package_manager.vulnerable().count() > 40; assert DiscoveredDependency.objects.count() > 220"

0 commit comments

Comments
 (0)