Skip to content

Commit c2f46df

Browse files
authored
[CRAVEX] SCA Integrations: Anchore (#1820)
Signed-off-by: tdruez <[email protected]>
1 parent 402c9a6 commit c2f46df

File tree

3 files changed

+5751
-0
lines changed

3 files changed

+5751
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Generate SBOM with Anchore Grype and load into ScanCode.io
2+
3+
# This workflow:
4+
# 1. Generates a CycloneDX SBOM for a container image using Anchore Grype.
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+
on:
12+
workflow_dispatch:
13+
schedule:
14+
# Run once a week (every 7 days) at 00:00 UTC on Sunday
15+
- cron: "0 0 * * 0"
16+
17+
permissions:
18+
contents: read
19+
20+
env:
21+
IMAGE_REFERENCE: "python:3.13.0-slim"
22+
23+
jobs:
24+
generate-and-load-sbom:
25+
runs-on: ubuntu-24.04
26+
steps:
27+
- name: Generate CycloneDX SBOM with Anchore Grype scanner
28+
uses: anchore/scan-action@v6
29+
with:
30+
image: ${{ env.IMAGE_REFERENCE }}
31+
output-format: cyclonedx-json
32+
output-file: "anchore-grype-sbom.cdx.json"
33+
fail-build: false
34+
35+
- name: Upload SBOM as GitHub Artifact
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: anchore-sbom-report
39+
path: "anchore-grype-sbom.cdx.json"
40+
retention-days: 20
41+
42+
- name: Import SBOM into ScanCode.io
43+
uses: aboutcode-org/scancode-action@main
44+
with:
45+
pipelines: "load_sbom"
46+
inputs-path: "anchore-grype-sbom.cdx.json"
47+
48+
- name: Verify SBOM Analysis Results in ScanCode.io
49+
shell: bash
50+
run: |
51+
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)