From c361afad709de620162e00882ec4fff86f196268 Mon Sep 17 00:00:00 2001 From: Chris Evich Date: Thu, 12 Jan 2023 16:15:12 -0500 Subject: [PATCH] Cirrus: Improve caching effectiveness Prior to this commit, the cache maintained for the main branch has grown to over 16gigabytes. Attempts to upload it are causing frequent branch- level CI failures due to being larger than the maximum allowable. Attempt to fix this by introducing a cache-grooming script and altering the cache-keys to track with dependency specification and build settings. Content for the grooming script comes mainly from three places: 1. [Cargo documentation](https://doc.rust-lang.org/nightly/cargo/guide/build-cache.html) 2. The rust-cache github action [(typescript) source code](https://github.com/Swatinem/rust-cache/tree/master/src) 3. This [cargo home in CI section](https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci) For branch-level cache, the grooming script will completely clobber it's cache at loosely-random intervals determined by the Cirrus Build ID. This is intended to prevent the cache from growing indefinitely. It's an non-ideal solution in a space full of very limited possibilities. Signed-off-by: Chris Evich --- .cirrus.yml | 21 ++++++---- contrib/cirrus/cache_groom.sh | 77 +++++++++++++++++++++++++++++++++++ contrib/cirrus/lib.sh | 6 +++ 3 files changed, 96 insertions(+), 8 deletions(-) create mode 100644 contrib/cirrus/cache_groom.sh diff --git a/.cirrus.yml b/.cirrus.yml index da578b79f..5d9a21663 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -50,16 +50,15 @@ build_task: # all PRs & branches will share caches with other PRs and branches # for a given $DEST_BRANCH and vX value. Adjust vX if cache schema # changes. - fingerprint_key: "cargo_v2_${DEST_BRANCH}_amd64" + fingerprint_script: echo -e "cargo_v3_${DEST_BRANCH}_amd64\n---\n$(