ci: include base image digest in depends cache key#7274
Conversation
The depends cache key previously used only the Dockerfile content hash, which didn't capture upstream base image updates (e.g. ubuntu:noble security patches bumping compiler minor versions). When the container was rebuilt with new toolchain versions, the cache key still matched the old cache, but gen_id computed different build_ids, causing every package to be rebuilt from source in the "Rebuild depends prefix" step. Add the ubuntu:noble manifest digest (fetched once via Docker Hub registry API in the check-skip job) to the depends cache key. This ensures the cache is properly invalidated when the base image changes. The digest query includes proper token auth and falls back to "unknown" on failure so CI is not blocked by transient registry issues. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
✅ Review complete (commit e41e5ad) |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThe changes modify GitHub Actions workflows to incorporate Docker base image digest information into the dependency cache strategy. In Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
thepastaclaw
left a comment
There was a problem hiding this comment.
Code Review
The base-image digest wiring is correct and the cache-key prefix change fixes the intended stale-cache problem, but the workflow currently keys on the top-level multi-arch ubuntu:noble manifest-list digest, which can trigger unnecessary depends cache rebuilds when only unrelated architectures change.
Reviewed commit: e41e5ad
🟡 1 suggestion(s)
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `.github/workflows/build.yml`:
- [SUGGESTION] lines 76-78: Tag-level manifest-list digest invalidates caches for unrelated architecture changes
Validated against the new digest lookup: the workflow requests the `application/vnd.docker.distribution.manifest.list.v2+json` representation for `library/ubuntu:noble` and uses the returned `docker-content-digest` header in every depends cache key. That digest is for the top-level multi-arch manifest list, so any update to any platform entry under `ubuntu:noble` changes the cache key, even if the concrete image used by a given runner architecture is unchanged. This can force avoidable depends rebuilds across amd64/arm64 jobs.
Issue being fixed or feature implemented
The depends cache key previously used only the
Dockerfilecontent hash, which didn't capture upstream base image updates (e.g.ubuntu:noblesecurity patches bumping compiler minor versions). When the container was rebuilt with new toolchain versions, the cache key still matched the old cache, butgen_idcomputed differentbuild_ids, causing every package to be rebuilt from source in theRebuild depends prefixstep.See any build-src job e.g. https://github.com/dashpay/dash/actions/runs/24005214781/job/70007740187
What was done?
Add the
ubuntu:noblemanifest digest (fetched once via Docker Hub registry API in thecheck-skipjob) to the depends cache key. This ensures the cache is properly invalidated when the base image changes. The digest query includes proper token auth and falls back to "unknown" on failure so CI is not blocked by transient registry issues.How Has This Been Tested?
Breaking Changes
Checklist: