Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2495 +/- ##
=======================================
Coverage 71.18% 71.18%
=======================================
Files 64 64
Lines 35588 35593 +5
=======================================
+ Hits 25333 25338 +5
Misses 10255 10255 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Xuanwo
left a comment
There was a problem hiding this comment.
Thank you for this change!
12776c7 to
26bb890
Compare
|
would it be possible to have a test? |
| let may_skip = var == "CARGO_MAKEFLAGS" // will have jobserver info which is extremely non-cacheable. | ||
| || var == "CARGO_BUILD_JOBS" // does not affect results | ||
| || var.starts_with("CARGO_REGISTRIES_") // CARGO_REGISTRIES_*_TOKEN contains non-cacheable secrets, and package IDs already uniquely identify the relevant registries. | ||
| || var.starts_with("CARGO_REGISTRY_") // same as CARGO_REGISTRIES_* | ||
| || var == "CARGO_TARGET_DIR" // already included in the file paths | ||
| || var == "CARGO_BUILD_BUILD_DIR" | ||
| || var == "CARGO_BUILD_TARGET_DIR" | ||
| || var.starts_with("CARGO_HTTP_") // not relevant | ||
| || var.starts_with("CARGO_NET_") | ||
| || var.starts_with("CARGO_TERM_") | ||
| || var.starts_with("CARGO_ALIAS_") | ||
| || var == "CARGO_CACHE_AUTO_CLEAN_FREQUENCY"; | ||
| if may_skip { |
There was a problem hiding this comment.
maybe something like:
| let may_skip = var == "CARGO_MAKEFLAGS" // will have jobserver info which is extremely non-cacheable. | |
| || var == "CARGO_BUILD_JOBS" // does not affect results | |
| || var.starts_with("CARGO_REGISTRIES_") // CARGO_REGISTRIES_*_TOKEN contains non-cacheable secrets, and package IDs already uniquely identify the relevant registries. | |
| || var.starts_with("CARGO_REGISTRY_") // same as CARGO_REGISTRIES_* | |
| || var == "CARGO_TARGET_DIR" // already included in the file paths | |
| || var == "CARGO_BUILD_BUILD_DIR" | |
| || var == "CARGO_BUILD_TARGET_DIR" | |
| || var.starts_with("CARGO_HTTP_") // not relevant | |
| || var.starts_with("CARGO_NET_") | |
| || var.starts_with("CARGO_TERM_") | |
| || var.starts_with("CARGO_ALIAS_") | |
| || var == "CARGO_CACHE_AUTO_CLEAN_FREQUENCY"; | |
| if may_skip { | |
| // Skip environment variables that shouldn't affect caching | |
| const CARGO_SKIP_VARS: &[&str] = &[ | |
| "CARGO_MAKEFLAGS", // jobserver info which is extremely non-cacheable | |
| "CARGO_BUILD_JOBS", // does not affect results | |
| "CARGO_TARGET_DIR", // already included in the file paths | |
| "CARGO_BUILD_BUILD_DIR", | |
| "CARGO_BUILD_TARGET_DIR", | |
| "CARGO_CACHE_AUTO_CLEAN_FREQUENCY", | |
| ]; | |
| const CARGO_SKIP_PREFIXES: &[&str] = &[ | |
| "CARGO_REGISTRIES_", // contains non-cacheable secrets, package IDs already identify registries | |
| "CARGO_REGISTRY_", // same as CARGO_REGISTRIES_* | |
| "CARGO_HTTP_", // not relevant | |
| "CARGO_NET_", | |
| "CARGO_TERM_", | |
| "CARGO_ALIAS_", | |
| ]; | |
| let may_skip = CARGO_SKIP_VARS.contains(&var.as_str()) | |
| || CARGO_SKIP_PREFIXES | |
| .iter() | |
| .any(|prefix| var.starts_with(prefix)); | |
| if may_skip { |
|
ping ? |
|
@copilot resolve the merge conflicts in this pull request |
| || var.starts_with("CARGO_REGISTRIES_") | ||
| || var == "CARGO_BUILD_JOBS" | ||
| { | ||
| let may_skip = var == "CARGO_MAKEFLAGS" // will have jobserver info which is extremely non-cacheable. |
There was a problem hiding this comment.
could this be a list of exact names plus a list of prefixes instead of a 12-branch boolean? easier to extend
| { | ||
| let may_skip = var == "CARGO_MAKEFLAGS" // will have jobserver info which is extremely non-cacheable. | ||
| || var == "CARGO_BUILD_JOBS" // does not affect results | ||
| || var.starts_with("CARGO_REGISTRIES_") // CARGO_REGISTRIES_*_TOKEN contains non-cacheable secrets, and package IDs already uniquely identify the relevant registries. |
There was a problem hiding this comment.
that trailing comment is too long, please move it above the block
| || var == "CARGO_BUILD_JOBS" // does not affect results | ||
| || var.starts_with("CARGO_REGISTRIES_") // CARGO_REGISTRIES_*_TOKEN contains non-cacheable secrets, and package IDs already uniquely identify the relevant registries. | ||
| || var.starts_with("CARGO_REGISTRY_") // same as CARGO_REGISTRIES_* | ||
| || var == "CARGO_TARGET_DIR" // already included in the file paths |
There was a problem hiding this comment.
are we sure? cargo can pass a relative --out-dir, so the same relative path under two different target dirs would collide. could you please explain the why here
| || var.starts_with("CARGO_TERM_") | ||
| || var.starts_with("CARGO_ALIAS_") | ||
| || var == "CARGO_CACHE_AUTO_CLEAN_FREQUENCY"; | ||
| if may_skip { |
There was a problem hiding this comment.
may_skip reads odd since we always skip when it's true, just skip? or inline it in the if
| OsString::from("CARGO_BUILD_JOBS"), | ||
| OsString::from("ignored"), | ||
| ), | ||
| (OsString::from("CARGO_TERM_COLOR"), OsString::from("never")), |
There was a problem hiding this comment.
only CARGO_TERM_COLOR is covered, please add the other new ones to the test too (CARGO_TARGET_DIR, CARGO_HTTP_, CARGO_REGISTRY_)
|
sorry but it needs to be rebased |
Excludes more irrelevant/redundant
CARGO_variables based on a blocklist(Another option could be to remove hashing of the
CARGO_variables completely — #2494)