You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently it's annoying to clean up build caches on CI systems because:
cargo build just keeps adding stuff to your cache directory without cleaning up unused artefacts
cargo clean just cleans out everything
Thus any cache that follows the approach of:
Load cache
Cargo build
Save cache
Will cause you to maintain a technically unbounded cache, and thus, step 1 and 3 will start taking more time than 2. (Have personally seen this happen after ~100 builds of not resetting a cache on shipcat).
Thus finding out a way to ensure the cache doesn't grow and require manual purging is useful.
CircleCI recommends adding dynamic suffixes to your cache keys to force cache expiry. E.g.:
target-{{ checksum "Cargo.lock" } (every time you make a version or add new dep)
target.release-{{ .Environment.CACHE_VERSION }} (whenever you want to manually bump)
But neither are really that satisfactory. Fast release cadence makes the first basically useless (blank cache constantly), and the second requires manual intervention every now and then (cache too big constantly).
One alternative is: cargo-sweep, but this only cleans based on date AFAIKT, which feels like just kicking the can down the road because it'll cause you to rebuild more than you need if you just haven't bumped that dependency in a while..
Another alternative is cargo-cache, but this seems to be more for general gc-ing and probably won't solve the unbounded cache problem.
Tools that would solve this could potentially be bundled inside the build image if it doesn't bloat it too much.
The text was updated successfully, but these errors were encountered:
clux
changed the title
find a satisfactory solution to caching on CI
find a better solution to caching on CI
Jul 27, 2019
The cache strategy on kube-rs with github actions is proving a bit better. No need to manually bump numbers, and the rust-cache action is proving excellent there.
Closing because CI caching issues is not really the purview of this repo, there are decent solutions, and my person TODO about finding a better alternative is now solved with github actions.
Problem
Currently it's annoying to clean up build caches on CI systems because:
cargo build
just keeps adding stuff to your cache directory without cleaning up unused artefactscargo clean
just cleans out everythingThus any cache that follows the approach of:
Will cause you to maintain a technically unbounded cache, and thus, step 1 and 3 will start taking more time than 2. (Have personally seen this happen after ~100 builds of not resetting a cache on shipcat).
Thus finding out a way to ensure the cache doesn't grow and require manual purging is useful.
There's a relevant cargo meta tracking issue for cargo cache improvements.
CI Suggestions
CircleCI recommends adding dynamic suffixes to your cache keys to force cache expiry. E.g.:
target-{{ checksum "Cargo.lock" }
(every time you make a version or add new dep)target.release-{{ .Environment.CACHE_VERSION }}
(whenever you want to manually bump)But neither are really that satisfactory. Fast release cadence makes the first basically useless (blank cache constantly), and the second requires manual intervention every now and then (cache too big constantly).
TravisCI has a only a manual option to clear your cache, and normally caches last for 28 days.
Related Tools
One alternative is:
cargo-sweep
, but this only cleans based on date AFAIKT, which feels like just kicking the can down the road because it'll cause you to rebuild more than you need if you just haven't bumped that dependency in a while..Another alternative is
cargo-cache
, but this seems to be more for general gc-ing and probably won't solve the unbounded cache problem.Tools that would solve this could potentially be bundled inside the build image if it doesn't bloat it too much.
The text was updated successfully, but these errors were encountered: