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

Provenance docker #452

Merged
merged 7 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
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 .ci/get-docker-provenance.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -euo pipefail

if [ ! -e dist/artifacts.json ] ; then
exit 1
fi

echo "Gather the container images generated and published with goreleaser"
images=$(jq -r '[.[] | select (.type=="Published Docker Image") | select(.name|endswith("latest")|not)]' dist/artifacts.json)
image_1=$(echo "$images" | jq -r '.[0].name')
image_2=$(echo "$images" | jq -r '.[1].name')
digest_1=$(echo "$images" | jq -r '.[0].extra.Digest')
digest_2=$(echo "$images" | jq -r '.[1].extra.Digest')

echo "Export github actions outputs"
echo "name_1=$image_1" >> "$GITHUB_OUTPUT"
echo "name_2=$image_2" >> "$GITHUB_OUTPUT"
echo "digest_1=$digest_1" >> "$GITHUB_OUTPUT"
echo "digest_2=$digest_2" >> "$GITHUB_OUTPUT"
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,36 @@ jobs:
- name: Release
run: make release

# Store artifacts to help with troubleshooting
- uses: actions/upload-artifact@v4
if: always()
with:
name: release
path: "dist/*.*"
retention-days: 5

- name: generate build provenance (binaries)
uses: github-early-access/generate-build-provenance@main
with:
subject-path: "${{ github.workspace }}/dist/*.*"

# See https://github.com/github-early-access/generate-build-provenance/issues/162
- name: container image digest
id: image
run: .ci/get-docker-provenance.sh

- name: generate build provenance (containers x86_64)
uses: github-early-access/generate-build-provenance@main
with:
subject-name: ${{ steps.image.outputs.name_1 }}
subject-digest: ${{ steps.image.outputs.digest_1 }}

- name: generate build provenance (containers arm64)
uses: github-early-access/generate-build-provenance@main
with:
subject-name: ${{ steps.image.outputs.name_2 }}
subject-digest: ${{ steps.image.outputs.digest_2 }}

- name: GitHub Release
run: make release-notes
env:
Expand Down
10 changes: 10 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ dockers:
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
- "--label=org.opencontainers.image.version={{ .Version }}"

docker_manifests:
- name_template: '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:{{ trimprefix .Tag "v" }}'
image_templates:
- '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}-x86_64:{{ trimprefix .Tag "v" }}'
- '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}-arm64:{{ trimprefix .Tag "v" }}'
- name_template: '{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}:latest'
image_templates:
- "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}-x86_64:latest"
- "{{ .Env.DOCKER_REGISTRY }}/{{ .Env.DOCKER_IMAGE_NAME }}-arm64:latest"

publishers:
- name: publish-aws
cmd: ./.ci/publish-aws.sh
Expand Down
Loading