-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove layer caching in favor of just running cargo #41
Conversation
- Remove buildpack's layer caching. Caching for the layer could be difficult, so removing it just leaves things up to Cargo which is the most accurate - Creates two folders under the cargo cache layer, `target/` and `home/`. The former is where build files go while the latter is where `cargo` cached downloads, like from crates.io go. - At the moment, a layer cached by the lifecycle does not preserve file mtimes. They are squashed in the name of reproducible builds. To get around this, the buildpack will preserve the mtimes of everything install, after cargo runs & then restore them the next time before cargo runs. This keeps consistent file mtimes, which is necessary for cargo to work properly. - Removes unnecessary directories from cargo's home directory, based on https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci, which saves space on the cache layer. Resolves: #24 and #25
…restoring if the mtimes.json file doesn't exist, it won't the first time we run.
I am struggling to understand what the |
Sure. So by default, the lifecycle doesn't not keep file modification times on a cached layer. It squashes everything to one standard date in the name of reproducible builds. This does not play well with When I removed the layer caching, which was broken, that exposed this issue. Essentially what happens is that I opened an issue with the lifecycle team about this: buildpacks/lifecycle#580 Because it seems odd that a layer only being used for cached/built time data should have the file modification times squashed. That layer doesn't impact the launch image, so it's not really impacting reproducible builds. Anyway, to work around this in the meantime, the best thing I could come up with is to preserve & restore the file modification times. So prior to running In my testing, this worked very well. It added little overhead and it resulted in correct builds with |
PS. there's one minor issue with the tests on this PR. I need to fix the time zones so they are consistent. It works locally because they are set for EST, but when it runs in CI they are UTC, so it fails. I'm hoping to do that soon, but it should be done before we merge. |
Alright, that tracks from what I saw then thanks! I think that the work around sound reasonable. I will happily merge this once the unit tests are passing on this PR. |
👍 tests are switched to UTC & all passing now |
target/
andhome/
. The former is where build files go while the latter is wherecargo
cached downloads, like from crates.io go.Resolves: #24 and #25