Prune superseded build caches on main - #383
Draft
gmarzot wants to merge 1 commit into
Draft
Conversation
Both cache kinds mint a new entry per run rather than replacing one: the dep key hashes the pin files, and ccache-action keys on a timestamp. Nothing removes the superseded generation, so the repo sits at 25.7 GB against GitHub's 10 GB limit and main's caches are the ones evicted, leaving PR jobs with nothing to restore. Keeps the newest generation of each cache family after build and publish have saved this run's. Measured against the current cache list: 16 entries, 12.5 GB. Refs #381
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.
Draft — the numbers are measured, but this deletes caches, so it wants a look
before it runs.
Implements #381, and covers one thing that issue missed.
What accumulates
Both cache kinds mint a new entry per run rather than replacing one:
hashFiles('build/deps/github_hashes/**'), so every pinchange makes a fresh ~1.3 GB entry per platform
ccache-actionkeys on a timestamp, so every run makes a fresh ~500 MBentry per lane.
max-size: 500Mbounds each entry, not how many exist#381 only described the dep half. The ccache half is about the same size.
Measured effect
Against the live cache list for
main(36 entries, 25.7 GB), keeping the newestgeneration of each family selects 16 entries, 12.5 GB:
That takes the repo from 25.7 GB to 13.5 GB.
It does not get us under the limit
13.5 GB is still above GitHub's 10 GB, so eviction continues, just more slowly.
Closing the rest needs a policy call rather than more pruning — the candidates are
dropping dep caches for the sanitizer publish lanes (~2.6 GB), lowering ccache
max-size, or caching fewer publish platforms. Worth deciding separately; thischange is worth having either way.
How it works
A
prune-cachesjob afterbuildandpublish,mainonly,actions: write.It runs after those jobs so this run's caches are already saved and are the
generation kept.
if: always()so a red build still gets pruned — a failed runshould not also leave the budget blown.
Family is the key minus its varying suffix, handling both shapes.
Verifying
gh cache deletecannot be rehearsed, but everything up to it was run againstlive data:
identical to the prototype
generation and no unrecognized key is ever chosen
IFS=$'\t' readloop parses all 16 rows and totals correctlyThe first real run should log
==> freed 12507 MBor close to it, and the repo'scache usage should drop to ~13.5 GB.
This change is