Skip to content

Commit 622e509

Browse files
authored
chore: compare digest with retry before fail (#57)
1 parent 17d3038 commit 622e509

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

.github/codeowners

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Matched against repo root (asterisk)
2-
* @mishraomp @DerekRoberts
2+
* @mishraomp @cberg-aot @DerekRoberts
33

44
# Matched against directories
55
# /.github/workflows/ @mishraomp @DerekRoberts

.github/workflows/.pr-close.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,25 @@ jobs:
100100
INSPECT="docker manifest inspect ghcr.io/${{ inputs.organization }}/${{ inputs.repository }}/${{ matrix.package }}"
101101
SOURCE=$(${INSPECT}:${{ inputs.tag_promote }} | jq -r '.manifests[] | select(.platform.architecture=="amd64") | .digest')
102102
TARGET=$(${INSPECT}:${{ inputs.target }} | jq -r '.manifests[] | select(.platform.architecture=="amd64") | .digest')
103+
if [ "${SOURCE}" != "${TARGET}" ]; then
104+
echo "ERROR: Tagging failed!"
105+
echo "RETRY=true" >> $GITHUB_ENV
106+
fi
107+
108+
- uses: shrink/actions-docker-registry-tag@v4
109+
if: env.RETRY == 'true'
110+
with:
111+
registry: ghcr.io
112+
repository: ${{ inputs.organization }}/${{ inputs.repository }}/${{ matrix.package }}
113+
target: ${{ inputs.target }}
114+
tags: ${{ inputs.tag_promote }}
115+
116+
- if: env.RETRY == 'true'
117+
run: |
118+
# Verify tagging after retry
119+
INSPECT="docker manifest inspect ghcr.io/${{ inputs.organization }}/${{ inputs.repository }}/${{ matrix.package }}"
120+
SOURCE=$(${INSPECT}:${{ inputs.tag_promote }} | jq -r '.manifests[] | select(.platform.architecture=="amd64") | .digest')
121+
TARGET=$(${INSPECT}:${{ inputs.target }} | jq -r '.manifests[] | select(.platform.architecture=="amd64") | .digest')
103122
if [ "${SOURCE}" != "${TARGET}" ]; then
104123
echo "ERROR: Tagging failed!"
105124
exit 1

.github/workflows/pr-open.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ jobs:
3232
target: latest
3333
tags: ${{ github.event.number }}
3434

35+
- run: |
36+
# Verify tagging
37+
INSPECT="docker manifest inspect ghcr.io/${{ github.repository }}/${{ matrix.package }}"
38+
SOURCE=$(${INSPECT}:latest | jq -r '.manifests[] | select(.platform.architecture=="amd64") | .digest')
39+
TARGET=$(${INSPECT}:${{ github.event.number }} | jq -r '.manifests[] | select(.platform.architecture=="amd64") | .digest')
40+
if [ "${SOURCE}" != "${TARGET}" ]; then
41+
echo "ERROR: Tagging failed!"
42+
exit 1
43+
fi
44+
3545
deploys:
3646
name: Deploys
3747
needs: [builds, validate]

0 commit comments

Comments
 (0)