-
Notifications
You must be signed in to change notification settings - Fork 8
192 lines (186 loc) · 8.4 KB
/
phase_3_yocto.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
---
name: Phase 3 - Yocto
on:
push:
paths:
- .github/workflows/phase_3_yocto.yml
env:
YOCTO_TAG: styhead
PARLAY_VERSION: 0.6.0
SBOMASM_VERSION: 0.1.5
SBOMQS_VERSION: 0.1.9
TRIVY_VERSION: 0.54.1
jobs:
Generate:
runs-on: ubuntu-latest
steps:
- name: Setup Environment
run: |
sudo apt update
sudo apt install -y gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 python3-subunit zstd liblz4-tool file locales libacl1
pip3 install websockets
sudo locale-gen en_US.UTF-8
- name: Checkout Yocto
run: |
git clone git://git.yoctoproject.org/poky
cd poky
git checkout ${YOCTO_TAG}
- name: Build Yocto
run: |
cd poky
source oe-init-build-env
echo "BB_NUMBER_THREADS=\"8\"" >> conf/local.conf
echo "PARALLEL_MAKE=\"-j 8\"" >> conf/local.conf
echo "INHERIT += \"rm_work\"" >> conf/local.conf
echo "BB_HASHSERVE = \"auto\"" >> conf/site.conf
echo "BB_HASHSERVE_UPSTREAM = \"wss://hashserv.yoctoproject.org/ws\"" >> conf/site.conf
echo "SPDX_PRETTY = "\1\"" >> conf/local.conf
echo -e "SSTATE_MIRRORS = \" \\ \nfile://.* http://sstate.yoctoproject.org/all/PATH;downloadfilename=PATH \\\n \\ \nfile://.* http://sstate.yoctoproject.org/dev/PATH;downloadfilename=PATH \\\n \\ \n\"" >> conf/site.conf
cat conf/local.conf
cat conf/site.conf
bitbake core-image-minimal
- name: Upload Generated SPDX SBOM
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
with:
name: generated-yocto-sbom-spdx
path: "poky/build/tmp/deploy/images/qemux86-64/core-image-minimal-qemux86-64.rootfs.spdx.json"
# Augment:
# runs-on: ubuntu-latest
# needs: Generate
# steps:
#
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
#
# - name: Download all workflow run artifacts
# uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
#
# - name: Install sbomasm
# run: |
# curl -L -o /tmp/sbomasm \
# "https://github.com/interlynk-io/sbomasm/releases/download/v${SBOMASM_VERSION}/sbomasm-linux-amd64"
# chmod +x /tmp/sbomasm
#
# - name: Augment Kubectl SPDX
# run: |
# # Augment the Generated SPDX with updated document information
# # - Using `--append` option to ensure the author information is appended instead
# # of replacing the tool information.
# /tmp/sbomasm edit --append --subject Document \
# --author 'CISA Tiger Group for SBOM Generation Reference Implementations' \
# --supplier 'kubernetes (https://kubernetes.io/kubectl)' \
# --repository 'https://github.com/kubernetes/kubectl' \
# --license 'Apache-2.0 (https://raw.githubusercontent.com/kubernetes/kubectl/refs/heads/master/LICENSE)' \
# generated-kubectl-sbom-spdx/generated-kubectl-sbom.spdx.json > augmented_kubectl-sbom.spdx.json
#
# # Augment the Generated SPDX with updated primary component information
# /tmp/sbomasm edit --subject primary-component \
# --supplier 'kubernetes (https://kubernetes.io/kubectl)' \
# --repository 'https://github.com/kubernetes/kubectl' \
# --license 'Apache-2.0 (https://raw.githubusercontent.com/kubernetes/kubectl/refs/heads/master/LICENSE)' \
# augmented_kubectl-sbom.spdx.json > /tmp/augmented_kubectl-sbom.spdx.json
#
# - name: Augment Kubectl CycloneDX
# run: |
# # Augment the Generated CycloneDX with updated document information
# /tmp/sbomasm edit --subject Document \
# --author 'CISA Tiger Group for SBOM Generation Reference Implementations' \
# --supplier 'kubernetes (https://kubernetes.io/kubectl)' \
# --lifecycle 'pre-build' \
# --repository 'https://github.com/kubernetes/kubectl' \
# --license 'Apache-2.0 (https://raw.githubusercontent.com/kubernetes/kubectl/refs/heads/master/LICENSE)' \
# generated-kubectl-sbom-cyclonedx/generated-kubectl-sbom.cdx.json > augmented_kubectl-sbom.cdx.json
#
# # Augment the Generated CycloneDX with updated primary component information
# /tmp/sbomasm edit --subject primary-component \
# --author 'CISA Tiger Group for SBOM Generation Reference Implementations' \
# --supplier 'kubernetes (https://kubernetes.io/kubectl)' \
# --repository 'https://github.com/kubernetes/kubectl' \
# --license 'Apache-2.0 (https://raw.githubusercontent.com/kubernetes/kubectl/refs/heads/master/LICENSE)' \
# augmented_kubectl-sbom.cdx.json > /tmp/augmented_kubectl-sbom.cdx.json
#
# - name: Upload Augmented SPDX SBOM
# uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
# with:
# name: augmented-kubectl-sbom-spdx
# path: "/tmp/augmented_kubectl-sbom.spdx.json"
#
# - name: Upload Augmented CycloneDX SBOM
# uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
# with:
# name: augmented-kubectl-sbom-cyclonedx
# path: "/tmp/augmented_kubectl-sbom.cdx.json"
#
# Enrich:
# runs-on: ubuntu-latest
# needs: Augment
# steps:
#
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
#
# - name: Download all workflow run artifacts
# uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
#
# - name: Install parlay
# run: |
# curl -Ls https://github.com/snyk/parlay/releases/download/v${PARLAY_VERSION}/parlay_Linux_x86_64.tar.gz | tar xvz -C /tmp
# chmod +x /tmp/parlay
#
# - name: Enrich Kubectl CycloneDX
# run: |
# /tmp/parlay ecosystems enrich \
# augmented-kubectl-sbom-cyclonedx/augmented_kubectl-sbom.cdx.json > /tmp/enriched_kubectl-sbom.cdx.json
#
# - name: Enrich Kubectl SPDX
# run: |
# /tmp/parlay ecosystems enrich \
# augmented-kubectl-sbom-spdx/augmented_kubectl-sbom.spdx.json > /tmp/enriched_kubectl-sbom.spdx.json
#
# - name: Upload Enriched SPDX SBOM
# uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
# with:
# name: enriched-kubectl-sbom-spdx
# path: "/tmp/enriched_kubectl-sbom.spdx.json"
#
# - name: Upload Enriched CycloneDX SBOM
# uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
# with:
# name: enriched-kubectl-sbom-cyclonedx
# path: "/tmp/enriched_kubectl-sbom.cdx.json"
#
# - name: Save Final SBOMs
# run: |
# cp /tmp/enriched_kubectl-sbom.spdx.json /tmp/final_kubectl-sbom.spdx.json
# cp /tmp/enriched_kubectl-sbom.cdx.json /tmp/final_kubectl-sbom.cdx.json
#
# - name: Upload Final SPDX SBOM
# uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
# with:
# name: final-kubectl-sbom-spdx
# path: "/tmp/final_kubectl-sbom.spdx.json"
#
# - name: Upload Final CycloneDX SBOM
# uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
# with:
# name: final-kubectl-sbom-cyclonedx
# path: "/tmp/final_kubectl-sbom.cdx.json"
#
Validate:
# needs: Enrich
needs: Generate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Download SBOMs
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
- name: Install sbomqs
run: |
curl -L -o /tmp/sbomqs \
"https://github.com/interlynk-io/sbomqs/releases/download/v${SBOMQS_VERSION}/sbomqs-linux-amd64"
chmod +x /tmp/sbomqs
- name: "Display SBOM quality score through sbomqs"
run: |
echo \`\`\` >> ${GITHUB_STEP_SUMMARY}
for SBOM in $(find . -iname *spdx.json); do
/tmp/sbomqs score "$SBOM" >> ${GITHUB_STEP_SUMMARY}
done
echo \`\`\` >> ${GITHUB_STEP_SUMMARY}