Skip to content

Commit

Permalink
Generate SBOM
Browse files Browse the repository at this point in the history
(hacked a bit to reduce build time for testing)
  • Loading branch information
daniel-noland committed Oct 31, 2024
1 parent 289dc9f commit 42ed822
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 16 deletions.
28 changes: 23 additions & 5 deletions .github/workflows/build-and-push-container.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Build
on:
workflow_dispatch:
pull_request:
branches: "*"
push:
Expand Down Expand Up @@ -133,11 +134,28 @@ jobs:
done
- name: step summary
run: |
for f in /tmp/dpdk-sys/builds/*.md; do
echo "# $f" >> $GITHUB_STEP_SUMMARY
cat "$f" >> $GITHUB_STEP_SUMMARY
done
echo "# Outdated packages:" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
cat /tmp/dpdk-sys/builds/env.sysroot.gnu64.release.outdated.md >> $GITHUB_STEP_SUMMARY
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "# Runtime SBOM (gnu64):" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
cat /tmp/dpdk-sys/builds/env.sysroot.gnu64.release.runtime.sbom.md >> $GITHUB_STEP_SUMMARY
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "# Vuln scan (gnu64):" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
cat /tmp/dpdk-sys/builds/env.sysroot.gnu64.release.vulns.triage.md >> $GITHUB_STEP_SUMMARY
echo "" >> "$GITHUB_STEP_SUMMARY"
- uses: actions/upload-artifact@v4
with:
name: builds-"${{ matrix.rust.toolchain }}"
name: builds-${{ matrix.toolchain.key }}
path: /tmp/dpdk-sys/builds
# - name: Setup tmate session for debug
# if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# timeout-minutes: 30
# with:
# limit-access-to-actor: true
24 changes: 13 additions & 11 deletions scripts/sbom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@ declare -r sbomnix="github:tiiuae/sbomnix"
just build-sysroot

declare -r builds="/tmp/dpdk-sys/builds"
pushd "${builds}"
declare -r package="env.sysroot"

for libc in "musl64" "gnu64"; do
for profile in "debug" "release"; do
for dep_type in "runtime" "buildtime"; do
# shellcheck disable=SC2043
for profile in "release"; do
# shellcheck disable=SC2043
for dep_type in "runtime"; do
# shellcheck disable=SC2046,SC2006
nix run \
"${sbomnix}#sbomnix" \
Expand Down Expand Up @@ -42,15 +45,6 @@ for libc in "musl64" "gnu64"; do
--verbose=1 \
$([ "$dep_type" = "buildtime" ] && echo --buildtime) \
"${builds}/${package}.${libc}.${profile}"
# shellcheck disable=SC2046,SC2006
nix run \
"${sbomnix}#nixgraph" \
-- \
--out "${builds}/${package}.${libc}.${profile}.${dep_type}.nixgraph.dot" \
--depth=99999999 \
--verbose=1 \
$([ "$dep_type" = "buildtime" ] && echo --buildtime) \
"${builds}/${package}.${libc}.${profile}"
done
# shellcheck disable=SC2046,SC2006
nix run \
Expand All @@ -60,6 +54,14 @@ for libc in "musl64" "gnu64"; do
--verbose=1 \
--recursive \
"${builds}/${package}.${libc}.${profile}"
# shellcheck disable=SC2046,SC2006
nix run \
"${sbomnix}#nixgraph" \
-- \
--out "${builds}/${package}.${libc}.${profile}.${dep_type}.nixgraph.dot" \
--depth=10 \
--verbose=1 \
"${builds}/${package}.${libc}.${profile}"
done
done

Expand Down

0 comments on commit 42ed822

Please sign in to comment.