From 67427286732371f7cc797da298d89d3a1a929a04 Mon Sep 17 00:00:00 2001 From: Karsten Dambekalns Date: Thu, 5 Nov 2026 12:12:36 +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 --- .github/workflows/docker.build.yaml | 23 +++++++++++++++++++++-- Dockerfile | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.build.yaml b/.github/workflows/docker.build.yaml index 264d621..9c94cf3 100644 --- a/.github/workflows/docker.build.yaml +++ b/.github/workflows/docker.build.yaml @@ -159,6 +159,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 @@ -176,11 +192,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 4e0ef10..78ce48c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ # The stage runs on the build platform and cross-compiles, so no emulation is # involved. -FROM --platform=$BUILDPLATFORM golang:1-alpine AS envsubst-builder +FROM --platform=$BUILDPLATFORM harbor.flownative.io/docker.io/library/golang:1-alpine AS envsubst-builder ARG ENVSUBST_VERSION=v1.4.2 ARG TARGETOS