@@ -10,8 +10,6 @@ name: Generate SBOM with Trivy and load into ScanCode.io
1010
1111on :
1212 workflow_dispatch :
13- # TODO: Remove once working properly, ie before merging.
14- pull_request :
1513 schedule :
1614 # Run once a week (every 7 days) at 00:00 UTC on Sunday
1715 - cron : " 0 0 * * 0"
2321 IMAGE_REFERENCE : " python:3.13.0-slim"
2422
2523jobs :
26- generate-sbom :
27- runs-on : ubuntu-latest
24+ generate-and-load- sbom :
25+ runs-on : ubuntu-24.04
2826 steps :
29- - name : Generate SBOM for Alpine 3.17.0
27+ - name : Generate CycloneDX SBOM with Trivy
3028 uses :
aquasecurity/[email protected] 3129 with :
3230 scan-type : " image"
33- image-ref : " alpine:3.17.0 "
31+ image-ref : ${{ env.IMAGE_REFERENCE }}
3432 format : " cyclonedx"
35- output : " alpine-3.17- sbom.json"
33+ output : " trivy-report. sbom.json"
3634 scanners : " vuln,license"
3735 version : " latest"
3836
39- - name : Upload the SBOM
37+ - name : Upload SBOM as GitHub Artifact
4038 uses : actions/upload-artifact@v4
4139 with :
42- path : alpine-3.17-sbom.json
40+ name : trivy-sbom-report
41+ path : " trivy-report.sbom.json"
42+ retention-days : 20
4343
44- # generate-and-load-sbom:
45- # runs-on: ubuntu-24.04
46- # steps:
47- # - name: Generate CycloneDX SBOM with Trivy
48- # uses: aquasecurity/[email protected] 49- # with:
50- # scan-type: "image"
51- # image-ref: ${{ env.IMAGE_REFERENCE }}
52- # format: "cyclonedx"
53- # output: "trivy-report.sbom.json"
54- # scanners: "vuln,license"
55- # version: "latest"
56- #
57- # - name: Upload SBOM as GitHub Artifact
58- # uses: actions/upload-artifact@v4
59- # with:
60- # name: trivy-sbom-report
61- # path: "${{ github.workspace }}/trivy-report.sbom.json"
62- # retention-days: 20
63- #
64- # - name: Import SBOM into ScanCode.io
65- # uses: aboutcode-org/scancode-action@main
66- # with:
67- # pipelines: "load_sbom"
68- # inputs-path: "${{ github.workspace }}/trivy-report.sbom.json"
69- #
70- # - name: Verify SBOM Analysis Results in ScanCode.io
71- # shell: bash
72- # run: |
73- # scanpipe shell --command "from scanpipe.models import DiscoveredPackage, DiscoveredDependency; package_manager = DiscoveredPackage.objects; assert package_manager.count() > 90; assert package_manager.vulnerable().count() > 40; assert DiscoveredDependency.objects.count() > 190"
44+ - name : Import SBOM into ScanCode.io
45+ uses : aboutcode-org/scancode-action@main
46+ with :
47+ pipelines : " load_sbom"
48+ inputs-path : " trivy-report.sbom.json"
49+
50+ - name : Verify SBOM Analysis Results in ScanCode.io
51+ shell : bash
52+ run : |
53+ scanpipe shell --command "from scanpipe.models import DiscoveredPackage, DiscoveredDependency; package_manager = DiscoveredPackage.objects; assert package_manager.count() > 90; assert package_manager.vulnerable().count() > 40; assert DiscoveredDependency.objects.count() > 190"
0 commit comments