From 5e75cc73f937c8722136b04fee310368d0f02095 Mon Sep 17 00:00:00 2001 From: Nils <695449+poldixd@users.noreply.github.com> Date: Fri, 4 Dec 2026 09:42:56 +0100 Subject: [PATCH] Retry rate-limited Docker Hub manifest publication --- .github/workflows/main.yml | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4399e32..cc3e162 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -123,9 +123,11 @@ jobs: needs: [changes, docker] if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' runs-on: ubuntu-latest - timeout-minutes: 10 + timeout-minutes: 15 strategy: fail-fast: false + # Avoid a burst of registry requests when all image builds finish. + max-parallel: 1 matrix: ${{ fromJSON(needs.changes.outputs.matrix) }} steps: - name: Compute image tag @@ -164,8 +166,27 @@ jobs: arm64=$(cat "$RUNNER_TEMP/digests/arm64.txt") test -n "$amd64" test -n "$arm64" - docker buildx imagetools create --tag "poldixd/php:$TAG" \ - "poldixd/php@$amd64" "poldixd/php@$arm64" + attempt=1 + delay=30 + while true; do + if output=$(docker buildx imagetools create --tag "poldixd/php:$TAG" \ + "poldixd/php@$amd64" "poldixd/php@$arm64" 2>&1); then + printf '%s\n' "$output" + break + else + status=$? + printf '%s\n' "$output" >&2 + fi + # Retry rate limits; surface authentication or manifest errors immediately. + if ! printf '%s\n' "$output" | grep -Eiq 'too many requests|toomanyrequests' || + [ "$attempt" -ge 5 ]; then + exit "$status" + fi + echo "::warning::Docker Hub rate limited publishing $TAG (attempt $attempt/5); retrying in ${delay}s." + sleep "$delay" + attempt=$((attempt + 1)) + delay=$((delay * 2)) + done checks: name: Image checks