René's URL Explorer Experiment


Title: perf(ci): version refactor (remove Xref/status.sh) by davdhacs · Pull Request #19424 · stackrox/stackrox · GitHub

Open Graph Title: perf(ci): version refactor (remove Xref/status.sh) by davdhacs · Pull Request #19424 · stackrox/stackrox

X Title: perf(ci): version refactor (remove Xref/status.sh) by davdhacs · Pull Request #19424 · stackrox/stackrox

Description: Problem: -X ldflags break Go's build and test cache Go's build cache keys every action (compile, link, test) on an ActionID — a hash of all inputs that affect the output. The link ActionID includes the full -ldflags string (exec.go:linkActionID() — see fmt.Fprintf(h, "link\n") ... fmt.Fprintf(h, "ldflags %q\n", ldflags)). The old status.sh + //XDef: mechanism injected version data via -X ldflags: -X "github.com/stackrox/rox/pkg/version/internal.MainVersion=4.11.x-431-gbbcc7d3be2" -X "github.com/stackrox/rox/pkg/version/internal.GitShortSha=bbcc7d3be24" Since MainVersion and GitShortSha change on every commit, the ldflags string changes, which changes the link ActionID. This has two effects: Build cache miss at link step: every binary re-links on every commit, even if no source code changed. Go's compile cache uses dependency contentID (output hash) rather than actionID, so compile steps can still cache-hit. But the link step always re-runs because its ActionID includes the changed ldflags. On CI, this means ~100s spent re-linking binaries that haven't actually changed. Test cache miss at Phase 1: Go's test result cache computes a test binary identity from the test binary's build ActionID, which includes the link ActionID (test.go:builderTest() — the test binary hash flows through packageActionID() → linkActionID()). When the link ActionID changes, the test binary identity changes, and Go discards all cached test results — every test re-runs from scratch. Fix: generated zversion.go instead of -X ldflags Replace -X ldflags with a generated pkg/version/internal/zversion.go file that sets version data via init(). This eliminates -X from the link step entirely, making ldflags stable across commits (-s -w only). For tests, go-tool.sh writes only the base tag (e.g. "4.11.x") — stable across commits on the same release branch. For builds, it writes the full git describe output (e.g. "4.11.x-431-gbbcc7d3be2"). The generated zversion.go is a source file, so it flows through the compile ActionID (content-hashed). When its content doesn't change (test mode), the compile output is byte-identical, giving the same contentID, so all 4400+ downstream packages get cache hits at both compile and link. Only 2 packages recompile (the version packages themselves, whose output is byte-identical anyway). Result: build compilation step drops from 100s → 27s (3.7x), and this improvement works independently of the test cache fix. Companion PRs PR #19395: Phase 2 fix (stabilize file mtimes for test input validation). PR #19585: disable -buildvcs (split out from this PR). Test caching requires both Phase 1 (this PR) and Phase 2 (#19395). The build cache improvement from this PR works on its own. Prior art: PR #15609 PR #15609 was closed due to two blockers (comment). Both are now resolved: -coverprofile broke test caching (Go <1.25): fixed in Go 1.25 (golang/go#23565). We are on Go 1.25.5. release vs non-release GOTAGS sharing one cache: our research (PR #19576) showed they share 93% of entries — only 6/1952 packages have release build tags. Go correctly recompiles those when GOTAGS changes. Separating caches would duplicate 93% of entries. Measured results (both PRs combined) Job Master warm Combined warm Speedup go (GOTAGS="") 35m ~8m 4.5x go-postgres 31m ~36s 52x sensor-integration 26m ~2.5m 11x Build compilation step (this PR alone): 100s → 27s (3.7x), with 99.95% cache hit rate (2/4403 packages recompile). Testing and quality CI results are inspected Automated testing added unit tests added e2e tests added regression tests added compatibility tests modified existing tests How I validated my change Verified locally: go-build.sh generates full version, go-test.sh generates stable base tag Build produces correct version strings in binaries Prior CI runs confirmed 4.5-52x test speedup and 3.7x build speedup when combined with mtime fix Operator builds pass CI with the new BUILD_TAG mechanism

Open Graph Description: Problem: -X ldflags break Go's build and test cache Go's build cache keys every action (compile, link, test) on an ActionID — a hash of all inputs that affect the output. The link ActionID ...

X Description: Problem: -X ldflags break Go&#39;s build and test cache Go&#39;s build cache keys every action (compile, link, test) on an ActionID — a hash of all inputs that affect the output. The link A...

Opengraph URL: https://github.com/stackrox/stackrox/pull/19424

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:1c9e485b-eb38-095a-81d3-7b07d088f1e1
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idAE3E:3073D:13734E0:1BD7566:6A4CC211
html-safe-nonce8f433a2c0dcce2ca9e65a7b8f949d9f36811f7c5cf05021dbe71ccccf232ff43
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTNFOjMwNzNEOjEzNzM0RTA6MUJENzU2Njo2QTRDQzIxMSIsInZpc2l0b3JfaWQiOiI0MjQ0NTMxODAxNzY5MTY1MzI5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac5b95a171078a2f269d29e0159f6789942342f5291fa974236565831532a8ad96
hovercard-subject-tagpull_request:3396802721
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/stackrox/stackrox/pull/19424/files
twitter:imagehttps://avatars.githubusercontent.com/u/105243888?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/105243888?s=400&v=4
og:image:altProblem: -X ldflags break Go's build and test cache Go's build cache keys every action (compile, link, test) on an ActionID — a hash of all inputs that affect the output. The link ActionID ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None3d11bb817438277de2a940854450e83a7d32b6aeb5014e9e6b00a6423900251c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/stackrox/stackrox git https://github.com/stackrox/stackrox.git
octolytics-dimension-user_id40638982
octolytics-dimension-user_loginstackrox
octolytics-dimension-repository_id434017296
octolytics-dimension-repository_nwostackrox/stackrox
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id434017296
octolytics-dimension-repository_network_root_nwostackrox/stackrox
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasec03e7e569190bc89b638cdd4acb4b6c6b38a170a
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/stackrox/stackrox/pull/19424/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fstackrox%2Fstackrox%2Fpull%2F19424%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fstackrox%2Fstackrox%2Fpull%2F19424%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=stackrox%2Fstackrox
Reloadhttps://github.com/stackrox/stackrox/pull/19424/files
Reloadhttps://github.com/stackrox/stackrox/pull/19424/files
Reloadhttps://github.com/stackrox/stackrox/pull/19424/files
Please reload this pagehttps://github.com/stackrox/stackrox/pull/19424/files
stackrox https://github.com/stackrox
stackroxhttps://github.com/stackrox/stackrox
Notifications https://github.com/login?return_to=%2Fstackrox%2Fstackrox
Fork 181 https://github.com/login?return_to=%2Fstackrox%2Fstackrox
Star 1.3k https://github.com/login?return_to=%2Fstackrox%2Fstackrox
Code https://github.com/stackrox/stackrox
Issues 52 https://github.com/stackrox/stackrox/issues
Pull requests 541 https://github.com/stackrox/stackrox/pulls
Actions https://github.com/stackrox/stackrox/actions
Security and quality 0 https://github.com/stackrox/stackrox/security
Insights https://github.com/stackrox/stackrox/pulse
Code https://github.com/stackrox/stackrox
Issues https://github.com/stackrox/stackrox/issues
Pull requests https://github.com/stackrox/stackrox/pulls
Actions https://github.com/stackrox/stackrox/actions
Security and quality https://github.com/stackrox/stackrox/security
Insights https://github.com/stackrox/stackrox/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fstackrox%2Fstackrox%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fstackrox%2Fstackrox%2Fissues%2Fnew%2Fchoose
davdhacshttps://github.com/davdhacs
masterhttps://github.com/stackrox/stackrox/tree/master
davdhacs/go-cache-optimizationhttps://github.com/stackrox/stackrox/tree/davdhacs/go-cache-optimization
Conversation 18 https://github.com/stackrox/stackrox/pull/19424
Commits 1 https://github.com/stackrox/stackrox/pull/19424/commits
Checks 86 https://github.com/stackrox/stackrox/pull/19424/checks
Files changed https://github.com/stackrox/stackrox/pull/19424/files
Please reload this pagehttps://github.com/stackrox/stackrox/pull/19424/files
perf(ci): version refactor (remove Xref/status.sh) https://github.com/stackrox/stackrox/pull/19424/files#top
Show all changes 1 commit https://github.com/stackrox/stackrox/pull/19424/files
a564561 perf(ci): replace -X ldflags with generated zversion.go davdhacs Mar 24, 2026 https://github.com/stackrox/stackrox/pull/19424/commits/a564561fb26e9810fa501f9401b67d06507f6ae7
Clear filters https://github.com/stackrox/stackrox/pull/19424/files
Please reload this pagehttps://github.com/stackrox/stackrox/pull/19424/files
Please reload this pagehttps://github.com/stackrox/stackrox/pull/19424/files
.gitignore https://github.com/stackrox/stackrox/pull/19424/files#diff-bc37d034bad564583790a46f19d807abfe519c5671395fd494d8cce506c42947
Dockerfile https://github.com/stackrox/stackrox/pull/19424/files#diff-fb3f33cdd2a5865385222d244e9bdc9a7ebee2756d506f6495f83a5cff42b25a
Makefile https://github.com/stackrox/stackrox/pull/19424/files#diff-6973a61c21dd57b26f0452d3716fe9213974883a2fe1b216504bf63532cd1187
version_data.go https://github.com/stackrox/stackrox/pull/19424/files#diff-81f3ccdffa58c26628e843c1a4aab994eaac96ad712d221d41dc0bf043d22031
go-tool.sh https://github.com/stackrox/stackrox/pull/19424/files#diff-98fe5781c9a901030c3ba8b40f129fe11769fec10b4b2fb6dd0c67af124ce298
.gitignorehttps://github.com/stackrox/stackrox/pull/19424/files#diff-bc37d034bad564583790a46f19d807abfe519c5671395fd494d8cce506c42947
View file https://github.com/stackrox/stackrox/blob/a564561fb26e9810fa501f9401b67d06507f6ae7/.gitignore
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/stackrox/stackrox/pull/19424/{{ revealButtonHref }}
https://github.com/stackrox/stackrox/pull/19424/files#diff-bc37d034bad564583790a46f19d807abfe519c5671395fd494d8cce506c42947
https://github.com/stackrox/stackrox/blob/master/.github/CODEOWNERS#L59
operator/Dockerfilehttps://github.com/stackrox/stackrox/pull/19424/files#diff-fb3f33cdd2a5865385222d244e9bdc9a7ebee2756d506f6495f83a5cff42b25a
View file https://github.com/stackrox/stackrox/blob/a564561fb26e9810fa501f9401b67d06507f6ae7/operator/Dockerfile
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/stackrox/stackrox/pull/19424/{{ revealButtonHref }}
https://github.com/stackrox/stackrox/pull/19424/files#diff-fb3f33cdd2a5865385222d244e9bdc9a7ebee2756d506f6495f83a5cff42b25a
SourceryAIhttps://github.com/SourceryAI
Mar 25, 2026https://github.com/stackrox/stackrox/pull/19424/files#r2985623455
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/stackrox/stackrox/pull/19424/files
https://github.com/stackrox/stackrox/pull/19424/files#diff-fb3f33cdd2a5865385222d244e9bdc9a7ebee2756d506f6495f83a5cff42b25a
https://github.com/stackrox/stackrox/blob/master/.github/CODEOWNERS#L59
operator/Makefilehttps://github.com/stackrox/stackrox/pull/19424/files#diff-6973a61c21dd57b26f0452d3716fe9213974883a2fe1b216504bf63532cd1187
View file https://github.com/stackrox/stackrox/blob/a564561fb26e9810fa501f9401b67d06507f6ae7/operator/Makefile
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/stackrox/stackrox/pull/19424/{{ revealButtonHref }}
https://github.com/stackrox/stackrox/pull/19424/files#diff-6973a61c21dd57b26f0452d3716fe9213974883a2fe1b216504bf63532cd1187
https://github.com/stackrox/stackrox/pull/19424/files#diff-6973a61c21dd57b26f0452d3716fe9213974883a2fe1b216504bf63532cd1187
https://github.com/stackrox/stackrox/pull/19424/files#diff-6973a61c21dd57b26f0452d3716fe9213974883a2fe1b216504bf63532cd1187
https://github.com/stackrox/stackrox/pull/19424/files#diff-6973a61c21dd57b26f0452d3716fe9213974883a2fe1b216504bf63532cd1187
pkg/version/internal/version_data.gohttps://github.com/stackrox/stackrox/pull/19424/files#diff-81f3ccdffa58c26628e843c1a4aab994eaac96ad712d221d41dc0bf043d22031
View file https://github.com/stackrox/stackrox/blob/a564561fb26e9810fa501f9401b67d06507f6ae7/pkg/version/internal/version_data.go
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/stackrox/stackrox/pull/19424/{{ revealButtonHref }}
scripts/go-tool.shhttps://github.com/stackrox/stackrox/pull/19424/files#diff-98fe5781c9a901030c3ba8b40f129fe11769fec10b4b2fb6dd0c67af124ce298
View file https://github.com/stackrox/stackrox/blob/a564561fb26e9810fa501f9401b67d06507f6ae7/scripts/go-tool.sh
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/stackrox/stackrox/pull/19424/{{ revealButtonHref }}
https://github.com/stackrox/stackrox/pull/19424/files#diff-98fe5781c9a901030c3ba8b40f129fe11769fec10b4b2fb6dd0c67af124ce298
SourceryAIhttps://github.com/SourceryAI
Mar 25, 2026https://github.com/stackrox/stackrox/pull/19424/files#r2985623453
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/stackrox/stackrox/pull/19424/files
https://github.com/stackrox/stackrox/pull/19424/files#diff-98fe5781c9a901030c3ba8b40f129fe11769fec10b4b2fb6dd0c67af124ce298
Please reload this pagehttps://github.com/stackrox/stackrox/pull/19424/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.