Skip to content

Commit

Permalink
Merge pull request #717 from Automattic/add/provenance-attestation
Browse files Browse the repository at this point in the history
ci: attest build provenance for Docker images
  • Loading branch information
sjinks authored May 4, 2024
2 parents 7f3cfc1 + 5413227 commit 2b06102
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/actions/build-docker-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ runs:

- name: Build and push container image
uses: docker/build-push-action@v5
id: push
with:
context: ${{ inputs.context }}
file: ${{ inputs.file }}
Expand All @@ -77,6 +78,19 @@ runs:
cache-to: ${{ inputs.cache-to }}
no-cache: ${{ inputs.no-cache }}

- name: Get image name
shell: bash
id: imagename
run: echo "image_name=$(echo "${{ inputs.primaryTag }}" | cut -d ':' -f 1)" >> "${GITHUB_OUTPUT}"

- name: Attest
uses: actions/attest-build-provenance@897ed5eab6ed058a474202017ada7f40bfa52940 # v1.0.0
with:
subject-name: ${{ steps.imagename.outputs.image_name }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: false
if: inputs.push == 'true'

- name: Load image to local Docker
uses: docker/build-push-action@v5
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
contents: read
pull-requests: write
security-events: write
id-token: write
attestations: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build-skeleton.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
packages: write
contents: read
security-events: write
id-token: write
attestations: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/dev-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
contents: read
pull-requests: write
security-events: write
id-token: write
attestations: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/mu-plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
contents: read
pull-requests: write
security-events: write
id-token: write
attestations: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
contents: read
pull-requests: write
security-events: write
id-token: write
attestations: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/photon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
contents: read
pull-requests: write
security-events: write
id-token: write
attestations: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/php-fpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
contents: read
pull-requests: write
security-events: write
id-token: write
attestations: write
strategy:
fail-fast: false
matrix:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/skeleton.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
contents: read
pull-requests: write
security-events: write
id-token: write
attestations: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/traefik.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
contents: read
pull-requests: write
security-events: write
id-token: write
attestations: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/wordpress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ jobs:
packages: write
pull-requests: write
security-events: write
id-token: write
attestations: write
strategy:
fail-fast: false
matrix:
Expand Down

0 comments on commit 2b06102

Please sign in to comment.