-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Sharing target mount cache across builds with different RUSTFLAGS overwrites cache entries and results in cache misses. The reason is $CARGO_TARGET_DIR cache entries, despite depending on RUSTFLAGS are not keyed by them.
Context
Current version of the lib/rust library uses several mount caches per tuple of {runner, project, os_release}:
- One cache mount for
$CARGO_HOME, shared across all builds and supporting parallel access - A family of blocking-access cache mounts for
$CARGO_TARGET_DIR. One per calling Earthly target. Notice that an Earthly build can trigger multiple (Earthly) targets in parallel, each one of them using their own mount cache
The problem comes when RUSTFLAGS are changed, some cache entries might be overwritten, or when the user Earthfile has successive +CARGO builds in the same Earthly target using different RUSTFLAGS. These scenarios would result in the loss of the original cache entries.
References
Proposal
We could additionally key $CARGO_TARGET_DIR mount caches by the whole cargo command + hashOf(rustflags) to make sure these caches are only reused across builds of the same command, with the same RUSTFLAGS
Metadata
Metadata
Assignees
Labels
Type
Projects
Status