Title: perf(ci): stabilize file mtimes for Go test cache by davdhacs · Pull Request #19395 · stackrox/stackrox · GitHub
Open Graph Title: perf(ci): stabilize file mtimes for Go test cache by davdhacs · Pull Request #19395 · stackrox/stackrox
X Title: perf(ci): stabilize file mtimes for Go test cache by davdhacs · Pull Request #19395 · stackrox/stackrox
Description: Description Go's test cache validates inputs by (path, size, mtime) — not content. git checkout sets all mtimes to "now", so test results are never cached across CI runs. Fix: set tracked file and directory mtimes to a fixed date after checkout: git ls-files | xargs touch -t 200101010000 git ls-files | sed 's|/[^/]*$||' | sort -u | xargs touch -t 200101010000 Directory mtimes matter because tests using os.ReadDir/filepath.Walk (e.g. helm chart tests) check them too. git ls-files only lists files. Combined with #19617 (stable test ldflags), this enables full test caching on current master baseline: go 33m -> 7.2m (4.6x), go-postgres 31m -> 3.6m (8.6x). See #19618 for combined demo. Prior art #15609 by @janisz applied this with git-restore-mtime. It was closed due to two blockers at that time: GOTAGS matrix collision — release and non-release tests shared one cache, invalidating each other. Now fixed by #19580 (key-suffix). -coverprofile disabled test caching in Go <1.25. Now fixed in Go 1.25. Risk If a testdata file changes content but not size between commits, the test cache could return a stale result. This matches Go's own documented limitation. User-facing documentation CHANGELOG.md is updated OR update is not needed documentation PR is created and is linked above OR is not needed Testing and quality the change is production ready: the change is GA, or otherwise the functionality is gated by a feature flag CI results are inspected Automated testing modified existing tests How I validated my change CI green on all unit-test jobs Combined branch (#19618) warm run verified: go 33m -> 7.2m (4.6x), go-postgres 31m -> 3.6m (8.6x) Partially generated by AI.
Open Graph Description: Description Go's test cache validates inputs by (path, size, mtime) — not content. git checkout sets all mtimes to "now", so test results are never cached across CI runs. Fix: set tra...
X Description: Description Go's test cache validates inputs by (path, size, mtime) — not content. git checkout sets all mtimes to "now", so test results are never cached across CI runs. ...
Opengraph URL: https://github.com/stackrox/stackrox/pull/19395
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:6554d883-3d1e-0451-32f6-f5adeac2a069 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B154:3985C:5A7665:79B394:6A4D3FFA |
| html-safe-nonce | 713299e76e4a77be8fe332532907aee21a8fe99ce5474b094664eac94ce86ad1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMTU0OjM5ODVDOjVBNzY2NTo3OUIzOTQ6NkE0RDNGRkEiLCJ2aXNpdG9yX2lkIjoiNjk1ODIxNzUxMzc3MjMzNTA5OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 1d4bc27e9a2d3d9266f42404a02df28554119391357058716785879fb00d460a |
| hovercard-subject-tag | pull_request:3390042840 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/stackrox/stackrox/pull/19395/files |
| twitter:image | https://avatars.githubusercontent.com/u/105243888?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/105243888?s=400&v=4 |
| og:image:alt | Description Go's test cache validates inputs by (path, size, mtime) — not content. git checkout sets all mtimes to "now", so test results are never cached across CI runs. Fix: set tra... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 92571a8944142227b7e19cd10918b1ddd06e5066c1ad5bc7e4769cf6140a87e6 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/stackrox/stackrox git https://github.com/stackrox/stackrox.git |
| octolytics-dimension-user_id | 40638982 |
| octolytics-dimension-user_login | stackrox |
| octolytics-dimension-repository_id | 434017296 |
| octolytics-dimension-repository_nwo | stackrox/stackrox |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 434017296 |
| octolytics-dimension-repository_network_root_nwo | stackrox/stackrox |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 56fc8347865a14e2ec811533d68f929cf4e0ec19 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width