Skip to content

Retry rate-limited image pulls in the image audit - #2663

Merged
kmcginnes merged 2 commits into
mainfrom
image-audit-pull-retry
Nov 24, 2026
Merged

kmcginnes merged 2 commits into
mainfrom
image-audit-pull-retry

Conversation

@kmcginnes

Copy link
Copy Markdown
Collaborator

Summary

The image audit failed twice on main today (run 45451874675, run 45457877831) because ECR Public answered the anonymous image pull with TOOMANYREQUESTS: Data limit exceeded during a burst of merges. The scan never ran. Each run also fetched the image twice, once per Trivy step.

User-facing: none

Each audit job now pulls its image once, retrying only on a rate limit, and both Trivy steps scan that local copy:

 docker-image-audit / release-image-audit
+  env: TRIVY_IMAGE_SRC: docker        # was unset / remote
   checkout
+  bash scripts/pullImage.sh <image>   # retries rate limits: 10s, 20s, 40s, 80s
   trivy (SARIF)                       # unchanged
   upload SARIF                        # unchanged
   trivy (fail on findings)            # unchanged gates

scripts/pullImage.sh retries only when docker pull reports toomanyrequests or 429 Too Many Requests. Any other error fails at once. A rate limit that outlasts five attempts (150s of waiting) fails the job, so it never turns into a passing audit. The scan gates (severity, ignore-unfixed, exit-code) are untouched.

Evidence

Before: a rate-limited pull failed the job on the first try, before any scan.

After: scripts/pullImage.test.ts runs the script against a stub docker with both forms docker prints for a rate limit: it retries with doubling waits, fails after five attempts, and fails at once on manifest unknown.

Verified live: agent-tested the script with the real docker CLI against a local fake registry that always answers 429: five attempts, waits of 10, 20, 40 and 80 seconds, then exit 1. A registry that answers 404 failed at once with no retry.

Merge Danger

Door: two-way

Impact: CI-only

Only the image audit workflow changes. actionlint was not run.


🤖 Written by an AI agent on my behalf.

@kmcginnes kmcginnes left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@kmcginnes
kmcginnes merged commit 8a85577 into main Nov 24, 2026
6 checks passed
@kmcginnes
kmcginnes deleted the image-audit-pull-retry branch November 24, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant