Skip to content

Commit 0067725

Browse files
authored
[CRAVEX] SCA Integrations: ORT (part.1) (#1837)
Signed-off-by: tdruez <tdruez@nexb.com>
1 parent 3d8700a commit 0067725

13 files changed

+1737
-16
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Generate SBOM with ORT and load into ScanCode.io
2+
3+
# This workflow:
4+
# 1. Generates a CycloneDX SBOM for a requirement.txt file using ORT.
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+
pull_request:
17+
push:
18+
branches:
19+
- main
20+
21+
permissions:
22+
contents: read
23+
24+
jobs:
25+
generate-and-load-sbom:
26+
runs-on: ubuntu-24.04
27+
steps:
28+
- name: Create a Python requirements.txt
29+
run: |
30+
cat << 'EOF' > requirements.txt
31+
amqp==5.1.1
32+
appdirs==1.4.4
33+
asgiref==3.5.2
34+
urllib3==1.26.0
35+
EOF
36+
37+
- name: Run GitHub Action for ORT
38+
uses: oss-review-toolkit/ort-ci-github-action@v1
39+
40+
- name: Import SBOM into ScanCode.io
41+
uses: aboutcode-org/scancode-action@main
42+
with:
43+
pipelines: "load_sbom"
44+
inputs-path: "${{ env.ORT_RESULTS_PATH }}/bom.cyclonedx.json"
45+
scancodeio-repo-branch: "main"
46+
47+
- name: Verify SBOM Analysis Results in ScanCode.io
48+
shell: bash
49+
run: |
50+
scanpipe shell --command "from scanpipe.models import DiscoveredPackage, DiscoveredDependency; package_manager = DiscoveredPackage.objects; assert package_manager.count() >= 5; assert package_manager.vulnerable().count() >= 1; assert DiscoveredDependency.objects.count() >= 1"

docs/faq.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,10 @@ are actively supported and tested::
376376
- Anchore: https://anchore.com/sbom/
377377
- CycloneDX cdxgen: https://cyclonedx.github.io/cdxgen/
378378
- OWASP dep-scan: https://owasp.org/www-project-dep-scan/
379+
- OSS Review Toolkit (ORT): https://oss-review-toolkit.org/ort/
380+
- OSV-Scanner: https://osv.dev/
379381
- SBOM tool: https://github.com/microsoft/sbom-tool/
380382
- Trivy: https://trivy.dev/
381-
- OSV-Scanner: https://osv.dev/
382383

383384
.. note:: Imported SBOMs must follow the SPDX or CycloneDX standards, in JSON format.
384385
You can use the ``load_sbom`` pipeline to process and enhance these SBOMs in your

scanpipe/pipes/benchmark.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ def compare_purls(project, expected_purls):
7070
- Lines starting with '+' are unexpected in the project.
7171
"""
7272
sorted_project_purls = get_unique_project_purls(project)
73-
print(sorted_project_purls)
74-
7573
diff_result = difflib.ndiff(sorted_project_purls, expected_purls)
7674

7775
# Keep only lines that are diffs (- or +)

0 commit comments

Comments
 (0)