ci(render-quarto): pass GITHUB_TOKEN as BuildKit secret to avoid Docker API rate limit - #4028
ci(render-quarto): pass GITHUB_TOKEN as BuildKit secret to avoid Docker API rate limit#4028anshul23102 wants to merge 2 commits into
Conversation
…rate limit The Docker build step in render-quarto.yml runs make inside the container, which calls confirm_deps.R -> remotes::install_deps() when any package dependency is not already present in pecan/depends:latest. Those calls hit the unauthenticated GitHub API and fail with HTTP 403 when concurrent CI jobs exhaust the 60 req/hr limit. Fix: enable Docker BuildKit and pass GITHUB_TOKEN from the GitHub Actions environment as a BuildKit secret (id=GITHUB_PAT). The secret is mounted read-only inside the single RUN layer via --mount=type=secret, exported as GITHUB_PAT (the variable remotes respects), and never written into any image layer, so it does not appear in docker history or image metadata.
|
@anshul23102 Thanks for working on this and for your patience with the wait for review. I'm curious why you're passing the token only to the base build and not to other builds, especially For context, when we've used this approach in the past (see #3083) we passed the secret to all three of the Ping @robkooper: Any other factors we should consider before re-adding secrets? |
|
@infotroph Good question, and the answer turns out to hinge on a structural difference between this workflow and the main Docker GHA. render-quarto.yml only builds the base image, never depends. The depends image is not rebuilt in this workflow at all. The The GitHub API calls that caused the rate-limit failure came from On the broader picture: the main Docker GHA already passes GITHUB_PAT to all image builds. Looking at In short: this PR passes the token to the only image that is actually built in render-quarto.yml. Happy to expand it if I have misread the workflow structure. |
Summary
The
render-notebookCI job was failing intermittently with:This happened inside the Docker build step at
modules/data.atmosphere, whereconfirm_deps.Rcallsremotes::install_deps()when a package dependency is not already cached inpecan/depends:latest. Those calls hit the unauthenticated GitHub API (60 req/hr limit), which is exhausted during concurrent CI runs.Fix: Enable Docker BuildKit and pass
GITHUB_TOKENfrom the GitHub Actions environment as a BuildKit secret. The secret is mounted read-only inside the singleRUNlayer via--mount=type=secret, exported asGITHUB_PAT(the variableremotesconsults automatically), and is never written into any image layer -- it does not appear indocker historyor image metadata.Authenticated requests receive 5,000 req/hr, well above what the
makedependency checks need.Changes
.github/workflows/render-quarto.yml: enableDOCKER_BUILDKIT=1, passGITHUB_TOKENas a BuildKit secret todocker build.docker/base/Dockerfile: use--mount=type=secret,id=GITHUB_PATin theRUNlayer so the token is available as$GITHUB_PATduringmake.Test plan
render-notebookCI passes on this PR