Skip to content

perf(ci): use fixed version ldflags for tests to enable GOCACHE hits#19617

Draft
davdhacs wants to merge 1 commit intomasterfrom
davdhacs/fix-test-ldflags
Draft

perf(ci): use fixed version ldflags for tests to enable GOCACHE hits#19617
davdhacs wants to merge 1 commit intomasterfrom
davdhacs/fix-test-ldflags

Conversation

@davdhacs
Copy link
Contributor

Summary

Use fixed version strings for test ldflags instead of git-describe values. This makes link ActionIDs stable across commits, enabling Go's test result cache.

Change: When TOOL=test, skip status.sh and use 0.0.0-test for all version -X ldflags. Builds keep the current XDef/status.sh mechanism unchanged.

Also adds -buildvcs=false (Go 1.18+ VCS stamping changes link ActionIDs per commit).

Why this works

Go includes ldflags in the link ActionID. Changing -X MainVersion=...g<sha> per commit gives every test binary a new ActionID, preventing test result caching. Fixed ldflags = stable ActionIDs = cache hits.

Verification

Fixed ldflags (this PR):          git-describe ldflags (master):
  Commit A: 9s (seed)              Commit A: 9s (seed)
  Commit B: (cached)               Commit B: 9s  ← miss
  Commit C: (cached)               Commit C: 10s ← miss

Note: This PR fixes test cache Phase 1 (stable binary identity). Full test caching also requires #19395 (mtime fix for Phase 2). See the combined branch davdhacs/test-cache-combined-minimal for both together.

Partially generated by AI.

Tests don't need real version info. Use fixed version strings
(0.0.0-test) instead of git-describe values for test ldflags.
This makes link ActionIDs stable across commits, enabling Go's
test result cache to hit.

Also adds -buildvcs=false to stop Go 1.18+'s VCS stamping which
independently changes link ActionIDs on every commit.

Builds keep the current XDef/status.sh mechanism unchanged.

Verified locally: tests cache across commits with fixed ldflags.

Combined with the mtime fix (#19395), this enables full warm
test caching in CI (2.5-8.2x faster test jobs).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@openshift-ci
Copy link

openshift-ci bot commented Mar 25, 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

@rhacs-bot
Copy link
Contributor

Images are ready for the commit at fdfe8cb.

To use with deploy scripts, first export MAIN_IMAGE_TAG=4.11.x-447-gfdfe8cb6f5.

@codecov
Copy link

codecov bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 49.28%. Comparing base (c14d8db) to head (fdfe8cb).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #19617   +/-   ##
=======================================
  Coverage   49.28%   49.28%           
=======================================
  Files        2735     2735           
  Lines      206215   206215           
=======================================
+ Hits       101627   101636    +9     
+ Misses      97046    97038    -8     
+ Partials     7542     7541    -1     
Flag Coverage Δ
go-unit-tests 49.28% <ø> (+<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