Skip to content

perf(ci): add key-suffix to remaining matrix jobs sharing GOCACHE#19576

Closed
davdhacs wants to merge 1 commit intomasterfrom
davdhacs/gha-matrix-job-cache-fixes
Closed

perf(ci): add key-suffix to remaining matrix jobs sharing GOCACHE#19576
davdhacs wants to merge 1 commit intomasterfrom
davdhacs/gha-matrix-job-cache-fixes

Conversation

@davdhacs
Copy link
Copy Markdown
Contributor

Summary

Add key-suffix to 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-dependencies usages found three remaining collisions:

Workflow Job Matrix variants key-suffix
unit-tests.yaml go GOTAGS="", GOTAGS=release missing
unit-tests.yaml go-postgres GOTAGS="", GOTAGS=release missing
scanner-build.yaml pre-build-scanner-go-binary default, prerelease, race-condition-debug missing

build.yaml's pre-build-go-binaries and build-and-push-operator were already fixed in #19425.

Fix

Pass the matrix discriminator as key-suffix so each variant gets its own cache key.

Partially generated by AI.

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>
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Mar 24, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@davdhacs
Copy link
Copy Markdown
Contributor Author

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).

@davdhacs davdhacs closed this Mar 24, 2026
@rhacs-bot
Copy link
Copy Markdown
Contributor

Images are ready for the commit at 0bc4b0e.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.11.x-431-g0bc4b0e01c.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.25%. Comparing base (47557b3) to head (0bc4b0e).

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     
Flag Coverage Δ
go-unit-tests 49.25% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants