Repository navigation
ci: prune unused Go build-cache entries before saving - #4676
Conversation
First run showed timings but artifact-vs-cache was a confound. This imports the prior pruned artifact into a unique Actions Cache entry and compares identical cache restores (baseline vs pruned) after the same source change invalidating the TUI, with binary tests pinned to -count=1.
|
First hosted comparison is green: run 39504417698. Restore + build + forced-uncached tests: full cache 199s/234s; pruned 132s/132s; no cache 334s/240s. Inventory: full 18.60GB expanded, pruned 2.63GB; compressed 2.99GB vs 458MB. This is exploratory: pruned used artifact storage and was freshly warmed. The next revision compares both via Actions Cache after the same TUI source invalidation, with binary tests uncached too. Still draft; no production cache policy changed yet. |
|
Second controlled run is green: 39505994975. Both arms now use Actions Cache, invalidate the same TUI source, and force unit/binary tests to execute. Full: 201s / 224s. Pruned: 135s / 119s (mean 40% faster). Restore: full 62s / 115s, pruned 18s / 7s. Implemented main-only pre-save pruning with a separate v3 build-cache namespace (module cache unchanged). Current revision validates the actual Node24 post action and exact candidate save/restore on both Linux and Windows; PR remains draft. |
|
Final integration is green on both Linux and Windows: https://github.com/docker/docker-agent/actions/runs/39509360263 . Both platforms passed all 21 helper tests, saved trimmed caches (~463MB), restored the exact new cache, and passed builds/full tests after source invalidation. Verified post-prune precedes cache save. The regular CI run is also green: https://github.com/docker/docker-agent/actions/runs/39509360336 . Temporary experimental workflow removed; PR remains draft. Final patch changes only cache infrastructure/tests, not production Go code. |
|
@dgageot don't hesitate to involve @mpailloncy on such tuning if needed. He did it at scale in the past. |
Summary
actions/cachesaves. Keep PR jobs restore-only; leave module caching unchanged.Measured results
Controlled run: same source change, same runners/modules, both caches restored using Actions Cache. Unit and binary tests forced uncached. Times include cache restore, build, and tests; exclude common tool/module setup.
About 40% faster in this Linux comparison, not a guarantee for every job.
Validation
task build,task test,task lintpassed locally.$/syntax exception), workflow invariants and zizmor passed.Kept in draft for review. Expect a one-time cold build for each namespace on main; subsequent snapshots remain trimmed. Linux measurements are promising, not a guaranteed Windows speedup or whole-workflow saving.