From 713e0634ef5f01550a4310ed192d205ec9b6c7b1 Mon Sep 17 00:00:00 2001 From: Karsten Dambekalns Date: Thu, 5 Nov 2026 12:12:43 +0100 Subject: [PATCH] Pull base images through Harbor and retry Docker Hub requests On 2026-11-05 all build runs failed with 429 Too Many Requests from Docker Hub, mostly on HEAD requests during push and in the merge job, once as "unauthenticated pull rate limit". The Docker Hub account is a Personal one, limited to 200 pulls in 6 hours. The build stages and COPY --from images that came from Docker Hub are now pulled through the Docker Hub proxy in Harbor (harbor.flownative.io/docker.io/...), so they no longer count against the pull rate limit of the Docker Hub account. The proxy can be read anonymously, so builds without credentials keep working. The merge job retries every imagetools call up to five times with a growing delay (30 s to 4 min), and only inspects the result in Harbor, which spares Docker Hub some requests. Refs OPS-8R Co-Authored-By: Claude Opus 5.5 --- .github/workflows/docker.build.yaml | 23 +++++++++++++++++++++-- Dockerfile | 4 ++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.build.yaml b/.github/workflows/docker.build.yaml index 5388004..4600bcf 100644 --- a/.github/workflows/docker.build.yaml +++ b/.github/workflows/docker.build.yaml @@ -163,6 +163,22 @@ jobs: working-directory: ${{ runner.temp }}/digests run: | set -euo pipefail + + # Docker Hub answers bursts of requests with 429 Too Many Requests, + # so every call to it is retried with a growing delay. + retry() { + local attempt=1 delay=30 + until "$@"; do + if [ "${attempt}" -ge 5 ]; then + return 1 + fi + echo "::warning::Attempt ${attempt} failed, retrying in ${delay} seconds" + sleep "${delay}" + attempt=$((attempt + 1)) + delay=$((delay * 2)) + done + } + versions="$(find . -mindepth 1 -maxdepth 1 -type d -name 'digest-*' | sed -n 's|^\./digest-\([0-9.]*\)-[a-z0-9]*$|\1|p' | sort -u)" [ -n "${versions}" ] || { echo "::error::No digests found"; exit 1; } for version in ${versions}; do @@ -180,11 +196,14 @@ jobs: sources+=("${image}@sha256:${digest}") done echo "::group::${image}:${version}" - docker buildx imagetools create \ + retry docker buildx imagetools create \ --tag "${image}:${version%.*}" \ --tag "${image}:${version}" \ "${sources[@]}" - docker buildx imagetools inspect "${image}:${version}" + # Only Harbor is inspected, to spare Docker Hub the requests. + case "${image}" in + harbor.flownative.io/*) retry docker buildx imagetools inspect "${image}:${version}" ;; + esac echo "::endgroup::" done done diff --git a/Dockerfile b/Dockerfile index 24750ec..b346055 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ ARG PHP_BASE_IMAGE # The stage runs on the build platform and cross-compiles, so no emulation is # involved. -FROM --platform=$BUILDPLATFORM golang:1-alpine AS php-fpm-exporter-builder +FROM --platform=$BUILDPLATFORM harbor.flownative.io/docker.io/library/golang:1-alpine AS php-fpm-exporter-builder ARG PHP_FPM_EXPORTER_VERSION=0ef3d973d5046059993d90dc32c86f36eab0929f ARG TARGETOS @@ -41,7 +41,7 @@ USER root COPY root-files / -COPY --from=blackfire/blackfire:2 /usr/local/bin/blackfire /opt/flownative/php/bin/ +COPY --from=harbor.flownative.io/docker.io/blackfire/blackfire:2 /usr/local/bin/blackfire /opt/flownative/php/bin/ COPY --from=php-fpm-exporter-builder /out/php-fpm_exporter /opt/flownative/php/bin/php-fpm-exporter