Skip to content

Pin git feature version to avoid GitHub API rate limits - #145

Closed
phil-janeapp wants to merge 1 commit into
rails:mainfrom
phil-janeapp:pin-git-feature-version
Closed

phil-janeapp wants to merge 1 commit into
rails:mainfrom
phil-janeapp:pin-git-feature-version

Conversation

@phil-janeapp

@phil-janeapp phil-janeapp commented Nov 24, 2026 •

Copy link
Copy Markdown

The image builds fail intermittently with API rate limit exceeded. In run 45017003256 (tag ruby-2.3.7, #142), 11 of the build jobs failed with:

{"message":"API rate limit exceeded for 3.42.157.65. (But here's the good news: Authenticated requests get a higher rate limit. ...
ERROR: Feature "Git (from source)" (ghcr.io/devcontainers/features/git) failed to install!

Earlier runs of this workflow show the same failure on their first attempt and pass on a re-run.

Cause

The git feature is set to "version": "latest". To resolve latest, the feature's install.sh makes an unauthenticated request to https://api.github.com/repos/git/git/tags. The limit for unauthenticated requests is 60 per hour for each IP, and GitHub-hosted runners share their IPs. Often the limit is already used up when the job starts.

Fix

Pin the feature to a full x.y.z version. The feature only calls the API when the version does not have three parts (src/git/install.sh, "Partial version matching"). It then downloads the source tarball from github.com/git/git/archive/..., which is not a REST API request. 2.56.1 is the current latest version, so the image does not change.

Testing

I built the image with api.github.com blocked during the build (--add-host=api.github.com:127.0.0.1), which simulates a runner with no API limit left. I did this on ubuntu-24.04 runners in my fork (linux/amd64, Ruby 3.3.13) and locally (arm64, Ruby 4.0.10 and 3.3.0):

  • With this change, the build succeeds and git --version returns 2.56.1. The Ruby feature (mise, precompiled rubies) also needs no API calls.
  • With "latest", the build fails at the git feature, as in CI.
  • Without the block, the build also succeeds through devcontainers/ci@v0.3 with the same inputs as build-and-publish-image (push: never).

Notes

  • The build checks out inputs.image_tag, so this change affects only tags created after merge. A new tag (for example ruby-2.3.8) is necessary. Until then, re-running the failed jobs works.
  • From now on, git updates only when someone changes this version. I opened a follow-up PR that adds a weekly workflow to open bump PRs.
  • An alternative is "version": "os-provided". It removes all GitHub requests and the git compile step (about 160 s per job), but the image then gets Debian's git 2.47.

🤖 Description generated with Claude Code, approved by a human

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants