2020 - ' v*'
2121 branches :
2222 - main
23+ - ' pull-request/*'
2324 paths-ignore :
2425 - ' **/*.md'
2526 - ' docs/**'
@@ -214,6 +215,55 @@ jobs:
214215 subject-digest : ${{ matrix.image.digest }}
215216 push-to-registry : true
216217
218+ sbom-ko :
219+ needs : build-images
220+ runs-on : linux-amd64-cpu32
221+ permissions :
222+ contents : read
223+ id-token : write # required for Cosign keyless signing
224+ packages : write # needed to push attestations to GHCR
225+ security-events : write # only needed if you also upload SARIF somewhere
226+ strategy :
227+ matrix :
228+ image : ${{ fromJson(needs.build-images.outputs.images) }}
229+ steps :
230+ - name : Authenticate to GHCR
231+ uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
232+ with :
233+ registry : ghcr.io
234+ username : ${{ github.actor }}
235+ password : ${{ secrets.GITHUB_TOKEN }}
236+
237+ - name : Derive safe filename
238+ id : name
239+ shell : bash
240+ run : |
241+ IMAGE="${{ matrix.image.name }}"
242+ SAFE="$(basename "${IMAGE%%:*}")" # strip tag if present, then basename
243+ echo "safe=$SAFE" >> "$GITHUB_OUTPUT"
244+
245+ - name : Generate SBOM
246+ uses : anchore/sbom-action@8e94d75ddd33f69f691467e42275782e4bfefe84 # v0.20.9
247+ with :
248+ image : " ${{ matrix.image.name }}@${{ matrix.image.digest }}"
249+ format : cyclonedx-json
250+ output-file : sbom-${{ steps.name.outputs.safe }}.cdx.json
251+ upload-artifact : true # also uploads to the workflow run
252+ upload-release-assets : auto # 'auto' == assets on tags
253+
254+ - name : Install Cosign
255+ uses : sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0
256+
257+ - name : Cosign SBOM attestation
258+ env :
259+ COSIGN_EXPERIMENTAL : " 1"
260+ run : |
261+ cosign attest \
262+ --yes \
263+ --predicate sbom-${{ steps.name.outputs.safe }}.cdx.json \
264+ --type cyclonedx \
265+ "${{ matrix.image.name }}@${{ matrix.image.digest }}"
266+
217267 e2e-test :
218268 name : " E2E Test Published Images"
219269 runs-on : linux-amd64-cpu32
@@ -222,6 +272,7 @@ jobs:
222272 - container-publish
223273 - build-images
224274 - attest
275+ - sbom-ko
225276 env :
226277 CLUSTER_NAME : ' nvsentinel-uat'
227278 FAKE_GPU_NODE_COUNT : ' 10'
0 commit comments