Repository navigation
ci(cache): delete BuildKit cache blobs older than 30 days, weekly - #477
Conversation
GitHub evicts a cache entry only after a week without use, so a layer every image build reuses kept one entry for over a year. When GitHub lost the file behind it, every image build on main and on PRs failed with BlobNotFound until the entry was deleted by hand. A weekly workflow now deletes buildkit-blob-* entries created more than 30 days ago (adjustable, with a dry run, when started by hand), which bounds how long a lost blob can break the builds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Why
Since at least Nov 5, every image build failed: the CI base container, the instrumented project image and both release images, on
mainand on PRs (#474). They all failed on one GitHub Actions cache entry,1257206725, withBlobNotFound. That entry held BuildKit's empty layer (buildkit-blob-1-sha256:4f4fb700…) and was created on 2025-09-30. GitHub evicts an entry only after a week without use, and every build uses the empty layer, so the entry was never evicted. When GitHub lost the file behind it, BuildKit'stype=ghacache read failed the build instead of rebuilding the layer. Deleting the entry by hand fixed it.What this does
A new hygiene workflow,
.github/workflows/cache-cleanup.yml, runs weekly (Monday 02:23 UTC) and on demand. It deletesbuildkit-blob-*cache entries created more than 30 days ago, so no entry lives long enough to cause this again for long. Started by hand, it takesmax_age_daysand adry_runswitch.buildkit-blob-*keys. BuildKit's index entries and the Trivy database cache are left alone.mainrebuilds the deleted layers and writes them back. PR builds only read the cache, so a PR opened in that window builds those layers itself.actions: writeto delete cache entries and nothing else. It needs no checkout.docs/ci-overview.mdlists it with the other hygiene workflows.Validation
task lint(includes actionlint) andtask testpass.dry_run: trueto confirm the token can list caches.🤖 Generated with Claude Code
Summary by CodeRabbit