Skip to content

Pull the CodeBuild image from a ghcr.io copy before ECR Public - #5

Merged
HarshCasper merged 1 commit into
masterfrom
ci/mirror-codebuild-image
Oct 19, 2026
Merged

HarshCasper merged 1 commit into
masterfrom
ci/mirror-codebuild-image

Conversation

@HarshCasper

Copy link
Copy Markdown
Member

The last push run on master failed before LocalStack started (run):

Error response from daemon: toomanyrequests: Data limit exceeded
Pull of public.ecr.aws/codebuild/amazonlinux-x86_64-standard:5.0 failed, retrying in 60s

LocalStack runs every CodeBuild build in public.ecr.aws/codebuild/amazonlinux-x86_64-standard:5.0, and the job pulls it anonymously. Anonymous ECR Public pulls are capped per IP per month, and GitHub's runners share IPs, so a job that lands on a capped IP fails all 5 retries. That happened in 2 of the last 8 jobs.

The pull step now:

  1. Logs in to ghcr.io with the job's GITHUB_TOKEN and pulls ghcr.io/localstack-samples/codebuild-amazonlinux-x86_64-standard:5.0, then tags it with the ECR Public name LocalStack expects.
  2. If that copy does not exist (first run) or cannot be read (fork pull requests), pulls from ECR Public as before and pushes the copy, so later runs skip ECR Public.

The job gets packages: write for the push. The package is created private and linked to this repository, so it serves as a CI cache rather than a public redistribution of the AWS image. Deleting the package refreshes the copy on the next run.

Anonymous ECR Public pulls come from the runners' shared IPs and fail with
"toomanyrequests: Data limit exceeded" once an IP has used its monthly
quota (2 of the last 8 jobs), which retries on the same runner cannot fix.
Pull a copy from this organization's GitHub registry first, authenticated
with the job token; when it is missing, pull from ECR Public as before and
push the copy for later runs.

Claude-Session: https://claude.ai/code/session_01DZfDmzUBPqNAu3yFKyfCNM
@HarshCasper
HarshCasper merged commit 5f10c2e into master Oct 19, 2026
4 checks passed
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