Skip to content

Commit 5b7553f

Browse files
committed
feat: As a developer I want a pipeline to create a SBOM and analyse it with through the CSAF
1 parent 1888a98 commit 5b7553f

File tree

2 files changed

+130
-1
lines changed

2 files changed

+130
-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: "Security C4PO CI"
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: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
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+
on:
13+
pull_request:
14+
branches: [ "main" ]
15+
16+
17+
env:
18+
ANGULAR_PATH: security-c4po-angular
19+
API_PATH: security-c4po-api
20+
REPORTING_PATH: security-c4po-reporting
21+
CFG_PATH: security-c4po-cfg
22+
23+
ANGULAR_CLI_VERSION: 13
24+
25+
26+
jobs:
27+
28+
angular_job:
29+
name: "Angular SBOM Job"
30+
31+
runs-on: ubuntu-latest
32+
33+
steps:
34+
- name: "Check out code"
35+
uses: actions/checkout@v3
36+
37+
- name: "Use Node.js 14.x"
38+
uses: actions/setup-node@v1
39+
with:
40+
node-version: '14.x'
41+
cache: 'npm'
42+
43+
- name: "Install NPM dependencies"
44+
run: |
45+
cd $ANGULAR_PATH
46+
npm ci
47+
48+
- name: "Build assets"
49+
run: |
50+
cd $ANGULAR_PATH
51+
npm run build --if-present
52+
53+
- name: "Run tests"
54+
run: |
55+
cd $ANGULAR_PATH
56+
npm test
57+
58+
- name: "Generate SBOM"
59+
id: sbom
60+
uses: anchore/sbom-action@v0
61+
with:
62+
format: cyclonedx-json
63+
output-file: "${{ github.event.repository.name }}-sbom.cyclonedx.json"
64+
# upload-artifact: true
65+
66+
- name: Scan SBOM
67+
uses: anchore/scan-action@v3
68+
with:
69+
sbom: "${{ github.event.repository.name }}-sbom.cyclonedx.json"
70+
fail-build: false #fail_conditions: 'vulnerability_critical|vulnerability_high|vulnerability_medium|vulnerability_count'
71+
severity-cutoff: critical
72+
73+
- name: "Upload Scanned SBOM as Artifact"
74+
uses: actions/upload-artifact@v3
75+
with:
76+
name: scanned-sbom
77+
path: "${{ github.event.repository.name }}-sbom.cyclonedx.json"
78+
79+
# shift + cmd + /
80+
# api_job:
81+
# name: "API Job"
82+
83+
# runs-on: ubuntu-latest
84+
85+
# steps:
86+
# - name: "Check out code"
87+
# uses: actions/checkout@v3
88+
89+
# - name: "Set up JDK 11"
90+
# uses: actions/setup-java@v3
91+
# with:
92+
# java-version: '11'
93+
# distribution: 'temurin'
94+
95+
# - name: "Setup Gradle"
96+
# uses: gradle/gradle-build-action@v2
97+
# with:
98+
# gradle-version: 6.5
99+
100+
# - name: "Execute Gradle build"
101+
# run: |
102+
# cd $API_PATH
103+
# ./gradlew clean build -x dependencyCheckAnalyze
104+
105+
# reporting_job:
106+
# name: "Reporting Job"
107+
108+
# runs-on: ubuntu-latest
109+
110+
# steps:
111+
# - name: "Check out code"
112+
# uses: actions/checkout@v3
113+
114+
# - name: "Set up JDK 11"
115+
# uses: actions/setup-java@v3
116+
# with:
117+
# java-version: '11'
118+
# distribution: 'temurin'
119+
120+
# - name: "Setup Gradle"
121+
# uses: gradle/gradle-build-action@v2
122+
# with:
123+
# gradle-version: 6.5
124+
125+
# - name: "Execute Gradle build"
126+
# run: |
127+
# cd $REPORTING_PATH
128+
# ./gradlew clean build

0 commit comments

Comments
 (0)