ci(release): cache Docker layers for the release-selfhost multi-arch build#2578
Conversation
…build The multi-arch (linux/amd64 + linux/arm64, QEMU-emulated) docker/build-push-action step in release-selfhost.yml had no cache-from/cache-to, so every Orb release build was fully cold with zero layer reuse across runs -- unlike selfhost.yml's own CI build of the same Dockerfile, which already sets --cache-from type=gha --cache-to type=gha,mode=max. Every tagged orb-v* release (and every workflow_dispatch run) rebuilt the entire image from scratch for both platforms, including the slow apt-get install ca-certificates and npm install -g @anthropic-ai/claude-code @openai/codex layers in runtime-base -- especially costly under QEMU emulation for arm64, and unable to inherit the cache the same-commit selfhost.yml CI run already built and pushed to the GHA cache backend. Add the same cache-from: type=gha / cache-to: type=gha,mode=max to the build-push-action step. Neither workflow sets a custom cache scope, so both land in the GHA cache backend's default scope -- letting a release build reuse layers from prior releases AND from selfhost.yml's own build of the identical Dockerfile/commit.
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-02 09:53:00 UTC
⏸️ Suggested Action - Manual Review
Review summary Nits — 6 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2578 +/- ##
==========================================
+ Coverage 95.96% 95.98% +0.02%
==========================================
Files 226 229 +3
Lines 25470 25810 +340
Branches 9263 9389 +126
==========================================
+ Hits 24442 24774 +332
- Misses 417 425 +8
Partials 611 611 🚀 New features to boost your workflow:
|
…2842) #2578 (closing #2502) shared selfhost.yml's default GHA cache bucket with the release build for speed. A security scan correctly flagged that as a cache-poisoning vector: the release/publish path was reading from a bucket that regular CI writes to on every push/PR. Removing the cache entirely (a prior fix) closed the hole but gave up #2502's actual goal permanently. scope=release-orb restores the intended speedup properly instead: a GHA cache namespace that only this workflow's own tag/workflow_dispatch runs ever read from or write to, with zero exposure to anything a regular CI run produced. The first release still builds cold; every release after that reuses the arm64/QEMU-emulated layers from the prior release build in the same isolated scope.
Summary
docker/build-push-actionstep in.github/workflows/release-selfhost.ymlhad nocache-from/cache-to, so every Orb release build was fully cold with zero layer reuse across runs — unlikeselfhost.yml's own CI build of the sameDockerfile, which already sets--cache-from type=gha --cache-to type=gha,mode=max.orb-v*release (and everyworkflow_dispatchrun) rebuilt the entire image from scratch for both platforms, including the slowapt-get install ca-certificatesandnpm install -g @anthropic-ai/claude-code @openai/codexlayers inruntime-base— especially costly under QEMU emulation for the arm64 leg, and unable to inherit the cache the same-commitselfhost.ymlCI run already built and pushed to the GHA cache backend.cache-from: type=gha/cache-to: type=gha,mode=maxto thebuild-push-actionstep. Neither workflow sets a custom cachescope:, so both land in the GHA cache backend's default scope — letting a release build reuse layers from prior releases and fromselfhost.yml's own build of the identical Dockerfile/commit.Closes #2502.
Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally — this is a.github/workflows/**/test/**change with nosrc/**lines, so it carries no Codecov patch obligation; the new workflow-structure assertion passes.npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderateSafety
UI Evidencesection below — N/A, no UI changes.Notes
.github/workflows/**, a guarded path — expect this to be held for owner review rather than auto-merged, which is fine since I'm the repo owner.