Repository navigation
[CI] docker_pull_with_retry: Fall back to mirror.gcr.io when a Docker Hub pull fails - #7694
Conversation
… Hub pull fails Fork PRs get no Docker Hub credentials (aiter-test.yaml skips "Docker login" for them), so the build runner pulls rocm/pytorch anonymously and shares the per-IP rate limit. Docker Hub then answers 429 Too Many Requests on every retry, the wheel build fails, the GPU tests are skipped and the test gate fails without testing the change. Of the last 15 completed fork-PR Aiter Test runs, 7 failed, 6 of them at "Pull Aiter build image"; same-repo PRs had none in the same window. mirror.gcr.io, Google's public Docker Hub mirror, serves the same images. After a failed Docker Hub pull, the script pulls the image from the mirror, checks that its manifest digest is the one Docker Hub serves for that tag (a manifest HEAD, which doesn't count toward the pull limit), and only then retags it under its original name, so later steps are unchanged. If the digests differ or Docker Hub's can't be read, the mirror image isn't used. Images that name another registry or are pinned by digest are not redirected, and DOCKER_PULL_MIRROR="" turns the fallback off. Signed-off-by: syang-genai <[email protected]>
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: Reviews: |
WAITING ON AUTHORPR Self-ReviewRevision Waiting for the PR author. The readiness report will appear after the self-review answers are complete for this revision. Questions to answer in the PR description
Edit the Missing or invalid answers
Shadow mode reports what would block but keeps the status successful. Set |
gyohuangxin
left a comment
There was a problem hiding this comment.
LGTM, @syang-genai thanks for the optimization!
Summary
Fork PRs often fail the Aiter Test gate without being tested: their wheel build can't pull
rocm/pytorchbecause Docker Hub rate-limits the anonymous pull (429 Too Many Requests).docker_pull_with_retry.shnow falls back tomirror.gcr.io, checks that the image's manifest digest matches Docker Hub's, and retags it under its original name.Motivation
aiter-test.yamlskips "Docker login" for fork PRs, which keeps registry secrets away from fork code. Thebuild-only-aiterrunners start without the image, so "Pull Aiter build image" pulls it anonymously, sharing the runner's per-IP limit. When that limit is hit, all 5 attempts get 429 (60 s apart), the wheel build fails, the GPU tests are skipped, and the test gate fails.Of the last 49
pull_requestAiter Test runs (2026-11-09/10):The seventh fork failure was in "Standard Tests". One of the six is #7576 (job log). A re-run passes only if the limit has reset or the job lands on a runner that already has the image.
Changes
.github/scripts/docker_pull_with_retry.sh: after a faileddocker pullof a Docker Hub image, each attempt also triesmirror.gcr.io/<repo>:<tag>, which is Google's public Docker Hub mirror. The mirror image is used only if its manifest digest equals the one Docker Hub serves for that tag, read with a manifestHEADrequest (which doesn't count toward the pull limit). Only then is it retagged under the original name, sodocker run,docker image inspectand the rest of each workflow are unchanged.ghcr.io/...,localhost:5000/...) or are pinned by digest.DOCKER_PULL_MIRROR=""turns it off, andDOCKER_PULL_MIRROR=<host>points it at another Docker Hub mirror.Testing
See "Validation and unverified scope" below.
Documentation
The behavior is described in the script's comments; no user-facing docs cover CI image pulls.
Dependencies
The script now uses
curlandsed, both already on the runners.Breaking Changes
None.
PR Self-Review
Reviewed revision
55b8ef7
Behavior and intent
When Docker Hub refuses an anonymous pull, the script now gets the same image, verified by manifest digest, from
mirror.gcr.io. Fork PRs stop failing the Aiter Test gate at "Pull Aiter build image" on a 429.Validation and unverified scope
Both CI images,
rocm/pytorch:rocm7.2.4_ubuntu24.04_py3.12_pytorch_release_2.10.0and..._ubuntu22.04_py3.10_..., have the same manifest digest onmirror.gcr.ioand Docker Hub (sha256:4449f856…andsha256:3b71b642…).The script against a stub
docker, with the real Docker Hub digest lookup, over 12 cases:docker.io/prefix)ghcr.io,localhost:5000or digest-pinned imageDOCKER_PULL_MIRROR=""shellcheck0.11.0 is clean.Unverified: a real
docker pullfrommirror.gcr.ioon abuild-only-aiterrunner, which a fork PR's CI here would show. I also haven't measured whethermirror.gcr.iothrottles these runners, though it publishes no per-IP limit like Docker Hub's. If the fallback fails, the script fails exactly as it does today.PR-specific question
ci-config.yamlor the calling workflow, not from PR text. The script builds the mirror and Docker Hub URLs from it with fixed hosts and doesn't evaluate it. A fork PR can already change these files in its own run, so this adds no new path.docker image inspect. That is why the digest check exists: a mirror image is only given the Docker Hub name when its manifest digest equals the one Docker Hub serves for that tag. Without a match, it isn't tagged.Changed op tests
None.