Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add attestation to container images and SBOMs #1789

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
permissions:
contents: read
id-token: write
attestations: write
packages: write
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -96,6 +98,14 @@ jobs:
run: |
cosign sign -y quay.io/sustainable_computing_io/${{matrix.IMAGE_NAME}}:${{matrix.LABEL}}@${{ steps.build-push-image.outputs.digest }}

- name: Generate image attestation
if: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch')}}
uses: actions/attest-build-provenance@v1
with:
subject-name: quay.io/sustainable_computing_io/${{matrix.IMAGE_NAME}}
subject-digest: ${{ steps.build-push-image.outputs.digest }}
push-to-registry: ${{ inputs.pushImage }}

- name: Generate SBOM
uses: anchore/[email protected]
with:
Expand All @@ -110,3 +120,12 @@ jobs:
name: sbom-${{matrix.IMAGE_NAME}}-${{matrix.LABEL}}.spdx.json
path: ./sbom-${{matrix.IMAGE_NAME}}-${{matrix.LABEL}}.spdx.json
retention-days: 1

- name: Generate SBOM attestation
uses: actions/attest-sbom@v1
if: ${{ inputs.pushImage }}
with:
subject-name: quay.io/sustainable_computing_io/${{matrix.IMAGE_NAME}}
subject-digest: ${{ steps.build-push-image.outputs.digest }}
sbom-path: ./sbom-${{matrix.IMAGE_NAME}}-${{matrix.LABEL}}.spdx.json
push-to-registry: ${{ inputs.pushImage }}
Loading