Skip to content

Commit 44ea742

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

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

.github/workflows/debos.yml

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,13 @@ concurrency:
1717
group: ${{ github.workflow }}-${{ github.ref }}
1818
cancel-in-progress: true
1919

20+
env:
21+
# image build id; used for SBOM generation; TODO: should be used in image metadata too
22+
BUILD_ID: ${{ github.run_id }}-${{ github.run_attempt }}
23+
2024
jobs:
2125
build-debos:
26+
name: Build and upload debos recipes
2227
outputs:
2328
url: ${{ steps.upload_artifacts.outputs.url }}
2429
runs-on: [self-hosted, qcom-u2404, arm64]
@@ -86,7 +91,7 @@ jobs:
8691
debos -t u_boot_rb1:rb1-boot.img \
8792
debos-recipes/qualcomm-linux-debian-flash.yaml
8893
89-
- name: Stage build artifacts for publishing
94+
- name: Stage debos artifacts for publishing
9095
run: |
9196
set -ux
9297
# create a directory for the current run
@@ -112,3 +117,48 @@ jobs:
112117
id: upload_artifacts
113118
with:
114119
path: debos-artifacts
120+
121+
- name: Unpack rootfs to generate SBOM
122+
run: mkdir -v rootfs && tar -C rootfs -xf rootfs.tar.gz
123+
124+
# Syft is not packaged in Debian; it's available as a binary tarball or
125+
# as container image from upstream; it's available on arm64 and x86
126+
- name: Install Syft
127+
run: |
128+
set -ux
129+
apt -y install curl
130+
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh
131+
132+
- name: Generate SBOMs with Syft
133+
run: |
134+
set -ux
135+
# TODO should probably restrict catalogers a bit as the rootfs is
136+
# built entirely from deb packages
137+
bin/syft --version
138+
SYFT_FORMAT_PRETTY=true bin/syft \
139+
-o cyclonedx-json=rootfs-sbom.cyclonedx.json \
140+
-o spdx-json=rootfs-sbom.spdx.json \
141+
-o syft-json=rootfs-sbom.syft.json \
142+
-o syft-text=rootfs-sbom.syft.txt \
143+
-o syft-table \
144+
--parallelism `nproc` \
145+
--select-catalogers debian \
146+
--source-name qualcomm-linux-debian-rootfs \
147+
--source-version "${BUILD_ID}" \
148+
-v \
149+
scan rootfs
150+
151+
- name: Stage SBOMs for publishing
152+
run: |
153+
set -ux
154+
gzip rootfs-sbom.*
155+
dir="sboms"
156+
mkdir -v sboms
157+
cp -av rootfs-sbom.*.gz sboms
158+
159+
- name: Upload SBOMs as private artifacts
160+
uses: qualcomm-linux/upload-private-artifact-action@v1
161+
id: upload_sbom_artifacts
162+
with:
163+
path: sboms
164+

0 commit comments

Comments
 (0)