Repository navigation
Conversation
3ddc1e9 to
a937ddb
Compare
SCCACHE_BASEDIRS now normalizes cwd, CARGO_MANIFEST_DIR, CARGO_WORKSPACE_DIR, CARGO_TARGET_TMPDIR, CARGO_MANIFEST_PATH, CARGO_BIN_EXE_*, dep-info env var values, and the concatenated argument string in the Rust compiler's hash key computation. This enables cache hits when the same crate is compiled from different absolute paths on different machines (e.g., CI runners with different checkout roots). strip_basedir_prefix now also matches when the value equals the basedir minus its trailing '/', so `cwd == basedir` strips to the empty string rather than passing through. Without this, two machines with different checkout paths produced different hashes even with matching basedirs -- the feature's central claim.
a937ddb to
3845d98
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2678 +/- ##
==========================================
+ Coverage 74.17% 74.57% +0.39%
==========================================
Files 70 65 -5
Lines 39207 36425 -2782
==========================================
- Hits 29083 27163 -1920
+ Misses 10124 9262 -862 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Hi folks, any reason this can't go in yet? Needing the same myself! |
|
because most of the jobs fails |
|
@sylvestre - Oops, roger that, I'll start on a fork and try to clean up the PR! @mmastrac - Any more updates to the Vercel fork since April that should ride along? |
…w (sccache#2595) PR mozilla#2678 wired basedirs into the Rust hash key, but only from the daemon's startup config (storage.basedirs()). A long-lived server cannot know about git worktrees created after it started, so cross-checkout Rust hits required restarting the server whenever the worktree set changed — the exact pain sccache#2595 describes. Read SCCACHE_BASEDIRS from THIS compile's environment (each worktree sets its own root via cargo `[env]`) when present, falling back to the server's config basedirs. Each build now strips its own root per-request: no server-startup staleness, no restarts, parallel-safe across worktrees. Works in both the default and client-side compile paths (the daemon hashes either way and reads the per-request env). - config.rs: extract split_basedirs + normalize_basedirs (shared, so config parsing and the hasher produce byte-identical basedirs). - compiler/rust.rs: generate_hash_key prefers per-compile env basedirs. - tests/sccache_cargo.rs: add test_rust_cargo_basedirs_per_compile_env_cross_dir_cache_hit — the sccache server is started with NO basedirs; the per-compile env alone drives the cross-directory cache hit (fails before this change).
Each instance keeps its own cargo target directory by design, so an identical compile happens once per instance that needs it: on run 38450101413 lgwks_bot with one feature set was compiled by the bot suite and by both saturation legs, on three instances, and the build job's own "Build all workspace targets" step read 765 s of its 1045 s. sccache keys a compilation by its preprocessed source, compiler and flags, so the second and later jobs of a run read instead of compiling. SCCACHE_BASEDIRS is what makes that work across instances, because each runner checks out under its own rN/ and absolute paths would otherwise make every instance's key distinct: with two identical checkouts at different absolute paths under one SCCACHE_BASEDIRS, the second build was a cache hit. In CI it measured 558 hits over 909 compilations (365 Rust hits, 39%), and the two heaviest feature-matrix legs met their 5-minute bound on the next attempt once their own units were cached, after being cut at 5 m 19 s and 5 m 16 s. The cache is content-addressed and never stores a failed compilation, so a hit cannot hide a broken build; a host without the tool warns and compiles as before. No check is removed and none is weakened. Design-Plan: db826e11132fb65a (One sccache server on the machine, keyed across instances with SCCACHE_BASEDIRS (chosen)) Cited: https://github.com/mozilla/sccache/blob/main/docs/Configuration.md Cited: https://www.warpbuild.com/guides/sccache-github-actions Cited: mozilla/sccache#2678 Cited: mozilla/sccache#499
|
the CI has been failing on this one for a while, could you please have a look? otherwise, i will close it, thanks |
sccache 0.15 applies SCCACHE_BASEDIRS to C/C++ only. The Rust hash key still holds the cwd and CARGO_MANIFEST_DIR, so a crate built in two worktrees never shares a cache entry. Upstream PR mozilla/sccache#2678 (open, head 3845d98) strips basedirs there too and applies cleanly to 0.15.0. modules/desktop applies the overlay whenever rustBuildCache is on.
|
no news since my last ping, closing. reopen whenever you want to continue, thanks |
SCCACHE_BASEDIRSnow normalizes cwd,CARGO_MANIFEST_DIR,CARGO_WORKSPACE_DIR,CARGO_TARGET_TMPDIR,CARGO_MANIFEST_PATH,CARGO_BIN_EXE_*,dep-infoenv var values, and the concatenated argument string in the Rust compiler's hash key computation. This enables cache hits when the same crate is compiled from different absolute paths on different machines (e.g., CI runners with different checkout roots).This handles arguments that contain absolute paths at non-terminal positions, such as
-Clink-arg=blah,/path/to/somethingor (the nightly-only?)--remap-path-prefix=/full/path=/new.Added a number of unit tests around the functionality, as well as an integration test where we compile a crate from two different directories.
This fixes #2652