perf(ci): add key-suffix to remaining matrix jobs sharing GOCACHE#19576
perf(ci): add key-suffix to remaining matrix jobs sharing GOCACHE#19576
Conversation
Three matrix jobs share GOCACHE keys across their variants, causing each variant to write into the same cache and the GOCACHE trim (#19425) to delete entries used by other variants: - go (unit-tests.yaml): GOTAGS="" and GOTAGS=release - go-postgres (unit-tests.yaml): same - pre-build-scanner-go-binary (scanner-build.yaml): default/prerelease/race-condition-debug Fix: pass the matrix discriminator as key-suffix so each variant gets its own cache key. Found by auditing all cache-go-dependencies usages across all workflows. build.yaml's pre-build-go-binaries and build-and-push-operator were already fixed in #19425. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Skipping CI for Draft Pull Request. |
|
Closing — the GOTAGS variants (GOTAGS="" vs GOTAGS=release) share 92% of GOCACHE entries (only 6 packages have release build tags out of ~1952). Separating them with key-suffix would duplicate ~2GB of cache and cause the trim to delete shared entries that the other variant needs. The GOARCH dimension is already separated in the cache key. The GOTAGS dimension should remain shared. Same applies to scanner-build.yaml's default/prerelease/race-condition-debug matrix — these map to GOTAGS and share the vast majority of entries. Verified locally: GOTAGS="" produces 8917 entries, adding GOTAGS=release only adds 696 new entries (8% unique, 92% shared). |
|
Images are ready for the commit at 0bc4b0e. To use with deploy scripts, first |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19576 +/- ##
==========================================
- Coverage 49.26% 49.25% -0.01%
==========================================
Files 2735 2735
Lines 206138 206138
==========================================
- Hits 101546 101540 -6
- Misses 97045 97050 +5
- Partials 7547 7548 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
Add
key-suffixto three matrix jobs that share GOCACHE keys across their variants.Problem
After #19425 added GOCACHE trimming, matrix jobs that share a cache key have a new side-effect: each variant's trim step deletes entries used by other variants (since they weren't accessed during that variant's build). This turns cache sharing from "harmless bloat" into "actively deleting useful entries."
Audit of all
cache-go-dependenciesusages found three remaining collisions:goGOTAGS="",GOTAGS=releasego-postgresGOTAGS="",GOTAGS=releasepre-build-scanner-go-binarybuild.yaml's
pre-build-go-binariesandbuild-and-push-operatorwere already fixed in #19425.Fix
Pass the matrix discriminator as
key-suffixso each variant gets its own cache key.Partially generated by AI.