Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(earthly): copy cargo-chef to image layer
A `CACHE` serves as a persistent cache mount which remains popullated in between layer changes. This is very helpful for speeding up CI when there are genuine layer updates, since we can, e.g. maintain already fetched dependencies in `CARGO_HOME`, while adding whichever new ones. However, there has been a persistent issue with `cargo-chef`, which was installed into our `CARGO_HOME` shared `CACHE`. Rarely, the `CACHE` would be cleared by a command like `earthly prune`, but the layer that installed it was still assumed to be cached (and therefore skipped), leading to a very confusing error where the installation of `cargo-chef` was incorrectly skipped, and calls to it would fail. Copying it immediately after installation outside the persistent `CACHE` into the layer itself, means that if this step is considered cached by earthly, and therefore skipped, that a copy of the cargo-chef binary will be guaranteed to exist in a location already defined in the system `PATH`, avoiding the confusing and unpredictable error.
- Loading branch information