ci: rotate buildx cache weekly so npm@latest actually refreshes - #84
Merged
Conversation
The weekly cron never refreshed npm because the buildx layer cache was restored via a prefix restore-key on an unchanged master sha, so the `npm i npm@latest` layer was always a cache hit and froze npm at 11.9.0. Fold an ISO week stamp into the cache key + restore-key so the cache rotates once a week: each new week is a cold build that re-resolves npm@latest (and, with --pull, the base node image), while intra-week pushes still hit the cache for fast incremental builds. The key-format change also forces a one-time cold rebuild on merge, refreshing npm to >=11.13 immediately. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
fabriciojs
approved these changes
Jun 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
kooldev/node:24(and the other tags) ship an outdated npm — currently 11.9.0, below the 11.13.0 we need — even though the Dockerfile already doesRUN npm i --location=global npm@latest.npm@latestresolves at build time, and the weekly cron (0 0 * * 0) that's meant to keep images fresh never actually re-resolves it. The buildx layer cache is restored via a prefix restore-key (docker-buildx-${version}-) keyed on${{ github.sha }}. On the weekly cron,master's sha is unchanged, so every layer — includingRUN npm i npm@latest— is a cache hit and npm stays frozen until a code change alters the sha.Fix
Keep
npm@latest(no version pinning, no Dockerfile/template change) and rotate the layer cache once a week so the existing cron does a genuine cold rebuild:Compute cache weekstep emitting an ISO week stamp (date -u +%Y-%V).${week}into both the cachekeyandrestore-keys. Each new week → no restore-key match → cold build →npm@latestre-resolves. Intra-week pushes still hit the cache for fast incremental builds.--pullto the buildx build so cold rebuilds also refresh the basenode:*-alpinedigest.The key-format change (inserting
${week}) also invalidates the old prefix match, so merging this triggers a one-time cold rebuild that refreshes npm to ≥11.13 immediately — no manualworkflow_dispatchneeded.Verification
Testsstep already runsnpm -v; after merge it should print ≥ 11.13.0.🤖 Generated with Claude Code