Skip to content

Commit 70cc6bd

Browse files
committed
Build and test architecture images before push
Split the per-architecture workflow so each image is built locally, smoke-tested, and only then pushed to Docker Hub as an architecture-specific tag. This avoids publishing untested architecture images and keeps the sequence as build-test-push instead of build-push-test. In the manifest publish job, resolve the source image digests before logging in to Docker Hub, then publish the final multi-arch manifest from those digest references. This reduces authenticated Docker Hub rate-limit failures during manifest assembly.
1 parent c7099e3 commit 70cc6bd

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

.github/workflows/build.yaml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,20 @@ jobs:
9999
steps:
100100
- name: Set up Docker Buildx
101101
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4
102+
- name: Resolve architecture image digests
103+
id: resolve-digests
104+
run: |
105+
amd64_digest="$(docker buildx imagetools inspect "${IMAGE_NAME}:${{ matrix.key }}-amd64" --format '{{json .Manifest}}' | jq -r '.digest')"
106+
{
107+
echo "amd64_ref=${IMAGE_NAME}@${amd64_digest}"
108+
} >> "$GITHUB_OUTPUT"
109+
110+
if echo '${{ toJSON(matrix.platforms) }}' | jq -e '.[] == "linux/arm64"' > /dev/null; then
111+
arm64_digest="$(docker buildx imagetools inspect "${IMAGE_NAME}:${{ matrix.key }}-arm64" --format '{{json .Manifest}}' | jq -r '.digest')"
112+
{
113+
echo "arm64_ref=${IMAGE_NAME}@${arm64_digest}"
114+
} >> "$GITHUB_OUTPUT"
115+
fi
102116
- name: Login to Docker Hub
103117
uses: docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4
104118
with:
@@ -107,11 +121,11 @@ jobs:
107121

108122
- name: Publish multi-arch manifest
109123
run: |
110-
tags=("${IMAGE_NAME}:${{ matrix.key }}-amd64")
111-
if echo '${{ toJSON(matrix.platforms) }}' | jq -e '.[] == "linux/arm64"' > /dev/null; then
112-
tags+=("${IMAGE_NAME}:${{ matrix.key }}-arm64")
124+
refs=("${{ steps.resolve-digests.outputs.amd64_ref }}")
125+
if [[ -n "${{ steps.resolve-digests.outputs.arm64_ref }}" ]]; then
126+
refs+=("${{ steps.resolve-digests.outputs.arm64_ref }}")
113127
fi
114-
docker buildx imagetools create --tag "${IMAGE_NAME}:${{ matrix.key }}" "${tags[@]}"
128+
docker buildx imagetools create --tag "${IMAGE_NAME}:${{ matrix.key }}" "${refs[@]}"
115129
116130
- name: Add digest to build context
117131
run: |

0 commit comments

Comments
 (0)