Skip to content

Commit 4722960

Browse files
committed
workflows: debos: Generate SBOM of rootfs with syft
Signed-off-by: Loïc Minier <[email protected]>
1 parent 4b15a29 commit 4722960

File tree

1 file changed

+70
-1
lines changed

1 file changed

+70
-1
lines changed

.github/workflows/debos.yml

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ concurrency:
1919

2020
jobs:
2121
build-debos:
22+
name: Build and upload debos recipes
2223
outputs:
2324
url: ${{ steps.upload_artifacts.outputs.url }}
2425
runs-on: [self-hosted, qcom-u2404, arm64]
@@ -86,7 +87,7 @@ jobs:
8687
debos -t u_boot_rb1:rb1-boot.img \
8788
debos-recipes/qualcomm-linux-debian-flash.yaml
8889
89-
- name: Stage build artifacts for publishing
90+
- name: Stage debos artifacts for publishing
9091
run: |
9192
set -ux
9293
# create a directory for the current run
@@ -112,3 +113,71 @@ jobs:
112113
id: upload_artifacts
113114
with:
114115
path: ./uploads
116+
117+
rootfs-sbom:
118+
name: Generate SBOM for rootfs with Syft
119+
# nowadays also available on arm64; set x86 for predictability
120+
runs-on: [self-hosted, x86]
121+
needs: build-debos
122+
container:
123+
image: debian:trixie
124+
volumes:
125+
- /efs/qli/metaqcom/gh-runners/quic-yocto/downloads:/fileserver-downloads
126+
steps:
127+
# make sure we have latest packages first, to get latest fixes and to
128+
# avoid an automated update while we're building
129+
- name: Update OS packages
130+
run: |
131+
set -ux
132+
apt update
133+
apt -y upgrade
134+
apt -y full-upgrade
135+
136+
- name: Retrieve rootfs from fileserver
137+
run: cp -av /fileserver-downloads/${BUILD_ID}/rootfs.tar.gz .
138+
139+
- name: Unpack rootfs
140+
run: mkdir -v rootfs && tar -C rootfs -xf rootfs.tar.gz
141+
142+
# Syft is not packaged in Debian; it's available as a binary tarball or
143+
# as container image from upstream
144+
- name: Install Syft
145+
run: |
146+
set -ux
147+
apt -y install curl
148+
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh
149+
150+
- name: Generate SBOMs with Syft
151+
run: |
152+
set -ux
153+
# TODO should probably restrict catalogers a bit as the rootfs is
154+
# built entirely from deb packages
155+
bin/syft --version
156+
SYFT_FORMAT_PRETTY=true bin/syft \
157+
-o cyclonedx-json=rootfs-sbom.cyclonedx.json \
158+
-o spdx-json=rootfs-sbom.spdx.json \
159+
-o syft-json=rootfs-sbom.syft.json \
160+
-o syft-text=rootfs-sbom.syft.txt \
161+
-o syft-table \
162+
--parallelism `nproc` \
163+
--source-name qualcomm-linux-debian-rootfs \
164+
--source-version "${BUILD_ID}" \
165+
-v \
166+
scan rootfs
167+
168+
- name: Stage SBOMs for publishing
169+
run: |
170+
set -ux
171+
# compress SBOMs
172+
gzip rootfs-sbom*
173+
# create a directory for the current run
174+
BUILD_DIR="./uploads"
175+
mkdir -vp "${BUILD_DIR}"
176+
cp -av rootfs-sbom*.gz "${BUILD_DIR}"
177+
178+
- name: Upload SBOMs as private artifacts
179+
uses: qualcomm-linux/upload-private-artifact-action@v1
180+
id: upload_artifacts
181+
with:
182+
path: ./uploads
183+

0 commit comments

Comments
 (0)