Skip to content

Commit 059e08f

Browse files
fix: attest per-arch images instead of manifest list digest
- build-amd64/build-arm64: capture pushed image digest via docker inspect and expose as job output (steps.push.outputs.digest) - release: attest amd64 and arm64 images separately using per-arch digests from needs.build-amd64/build-arm64 outputs - release notes: gh attestation verify commands for each arch image and each SBOM
1 parent 1c5b4c3 commit 059e08f

1 file changed

Lines changed: 23 additions & 4 deletions

File tree

‎.github/workflows/build-haproxy-fips.yml‎

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ permissions:
2323
jobs:
2424
build-amd64:
2525
runs-on: ubuntu-24.04
26+
outputs:
27+
image_digest: ${{ steps.push.outputs.digest }}
2628
steps:
2729
- uses: actions/checkout@v4
2830
- uses: docker/login-action@v3
@@ -45,6 +47,7 @@ jobs:
4547
(cd /tmp/syft-install && sha256sum -c)
4648
tar -xzf "/tmp/syft-install/syft_${SYFT_VERSION}_linux_${ARCH_SYFT}.tar.gz" -C /usr/local/bin syft
4749
- name: Build and push amd64 image
50+
id: push
4851
env:
4952
VERSION: ${{ inputs.version || github.event.inputs.version }}
5053
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/gl-fips-haproxy
@@ -53,6 +56,9 @@ jobs:
5356
VERSION="${VERSION:-$(grep -m1 'VERSION:-' build-haproxy-fips.sh | grep -oP '(?<=VERSION:-)[^}]+')}"
5457
bash build-haproxy-fips.sh
5558
docker push ghcr.io/${{ github.repository_owner }}/gl-fips-haproxy:${VERSION}-amd64
59+
DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' \
60+
ghcr.io/${{ github.repository_owner }}/gl-fips-haproxy:${VERSION}-amd64 | cut -d@ -f2)
61+
echo "digest=${DIGEST}" >> "$GITHUB_OUTPUT"
5662
5763
- name: Upload SBOM artifact
5864
uses: actions/upload-artifact@v4
@@ -63,6 +69,8 @@ jobs:
6369

6470
build-arm64:
6571
runs-on: ubuntu-24.04-arm
72+
outputs:
73+
image_digest: ${{ steps.push.outputs.digest }}
6674
steps:
6775
- uses: actions/checkout@v4
6876
- uses: docker/login-action@v3
@@ -85,6 +93,7 @@ jobs:
8593
(cd /tmp/syft-install && sha256sum -c)
8694
tar -xzf "/tmp/syft-install/syft_${SYFT_VERSION}_linux_${ARCH_SYFT}.tar.gz" -C /usr/local/bin syft
8795
- name: Build and push arm64 image
96+
id: push
8897
env:
8998
VERSION: ${{ inputs.version || github.event.inputs.version }}
9099
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/gl-fips-haproxy
@@ -93,6 +102,9 @@ jobs:
93102
VERSION="${VERSION:-$(grep -m1 'VERSION:-' build-haproxy-fips.sh | grep -oP '(?<=VERSION:-)[^}]+')}"
94103
bash build-haproxy-fips.sh
95104
docker push ghcr.io/${{ github.repository_owner }}/gl-fips-haproxy:${VERSION}-arm64
105+
DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' \
106+
ghcr.io/${{ github.repository_owner }}/gl-fips-haproxy:${VERSION}-arm64 | cut -d@ -f2)
107+
echo "digest=${DIGEST}" >> "$GITHUB_OUTPUT"
96108
97109
- name: Upload SBOM artifact
98110
uses: actions/upload-artifact@v4
@@ -155,11 +167,17 @@ jobs:
155167
with:
156168
name: sbom-arm64
157169
path: sbom/
158-
- name: Attest container image
170+
- name: Attest amd64 image
171+
uses: actions/attest-build-provenance@v2
172+
with:
173+
subject-name: ghcr.io/${{ github.repository_owner }}/gl-fips-haproxy
174+
subject-digest: ${{ needs.build-amd64.outputs.image_digest }}
175+
push-to-registry: true
176+
- name: Attest arm64 image
159177
uses: actions/attest-build-provenance@v2
160178
with:
161179
subject-name: ghcr.io/${{ github.repository_owner }}/gl-fips-haproxy
162-
subject-digest: ${{ needs.push-manifest.outputs.image_digest }}
180+
subject-digest: ${{ needs.build-arm64.outputs.image_digest }}
163181
push-to-registry: true
164182
- name: Attest SBOMs
165183
uses: actions/attest-build-provenance@v2
@@ -194,9 +212,10 @@ jobs:
194212
echo ""
195213
echo "## Verify attestations"
196214
echo ""
197-
echo "### Container image"
215+
echo "### Container images"
198216
echo '```'
199-
echo "gh attestation verify oci://ghcr.io/${{ github.repository_owner }}/gl-fips-haproxy:${VERSION} --repo ${{ github.repository }}"
217+
echo "gh attestation verify oci://ghcr.io/${{ github.repository_owner }}/gl-fips-haproxy:${VERSION}-amd64 --repo ${{ github.repository }}"
218+
echo "gh attestation verify oci://ghcr.io/${{ github.repository_owner }}/gl-fips-haproxy:${VERSION}-arm64 --repo ${{ github.repository }}"
200219
echo '```'
201220
echo ""
202221
echo "### SBOMs"

0 commit comments

Comments
 (0)