Skip to content

Commit b050ccf

Browse files
committed
feat: As a developer I want a pipeline to create a SBOM and analyse it with through the CSAF
1 parent 661cbe5 commit b050ccf

File tree

2 files changed

+74
-1
lines changed

2 files changed

+74
-1
lines changed

.github/workflows/c4po-ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ name: "CI: Clean Build C4PO"
1111

1212
on:
1313
pull_request:
14-
branches: [ "main" ]
14+
# ToDo: Change back to main
15+
branches: [ "test" ]
1516

1617

1718
env:

.github/workflows/c4po-sbom.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
# GitHub recommends pinning actions to a commit SHA.
7+
# To get a newer version, you will need to update the SHA.
8+
# You can also reference a tag or branch, but the action may change without warning.
9+
10+
name: "Supply Chain Security C4PO SBOM Demo"
11+
12+
# ToDo: Use manual trigger when integrating
13+
# on: workflow_dispatch
14+
on:
15+
pull_request:
16+
branches: [ "main" ]
17+
18+
env:
19+
REPORTING_PATH: security-c4po-reporting
20+
CFG_PATH: security-c4po-cfg
21+
22+
23+
jobs:
24+
reporting_job:
25+
name: "Reportingservice SBOM Job"
26+
27+
runs-on: ubuntu-latest
28+
29+
steps:
30+
- name: "Check out code"
31+
uses: actions/checkout@v3
32+
33+
# Steps required for build process
34+
- name: "Set up JDK 11"
35+
uses: actions/setup-java@v3
36+
with:
37+
java-version: '11'
38+
distribution: 'temurin'
39+
40+
- name: "Setup Gradle"
41+
uses: gradle/gradle-build-action@v2
42+
with:
43+
gradle-version: 6.5
44+
45+
- name: "Execute Gradle build"
46+
run: |
47+
cd $REPORTING_PATH
48+
./gradlew clean build
49+
50+
# Steps required for SBOM creation
51+
- name: "Generate Reporting SBOM"
52+
id: reporting_sbom
53+
uses: anchore/sbom-action@v0
54+
with:
55+
path: './security-c4po-reporting'
56+
format: cyclonedx-json
57+
output-file: "${{ github.event.repository.name }}-reporting-sbom.cyclonedx.json"
58+
upload-artifact: true
59+
60+
# ToDo: Push SBOM to self-hosted Dependency Track instance
61+
62+
# Working version to generate & analyse SBOMs
63+
# Might be not good for company data
64+
- name: "Generate SBOM"
65+
id: sbom_generation
66+
uses: codenotary/sbom.sh-create@main
67+
with:
68+
scan_type: 'grypefs'
69+
target: './security-c4po-reporting' # . -> Assuming you want to scan the entire repository
70+
71+
- name: Output SBOM URL
72+
run: echo "The Reportingservice SBOM can be found at $SBOM_SHARE_URL"

0 commit comments

Comments
 (0)