From dc6fe46ceeb3ac267a5e393a57a48c9949daf2f4 Mon Sep 17 00:00:00 2001 From: eps1lon Date: Thu, 9 Feb 2023 17:15:45 +0100 Subject: [PATCH] test: Investigate the effective yarn cache When we restore a yarn cache that's not specific to a lockfile entry, we might restore packages that are no longer used. When we then run yarn install, we potentially add new packages to the cache. However, yarn is not clearing the unused packages from the global cache. So when we then save the cache we now retain unused packages in the global cache. This means that the global cache grows indefinitely. Restoring the cache isn't free so CI install times will degrade over time. Either we periodically prune the cache, or just not restore anything unless we have an exact hit. The chosen tradeoff depends on the relation of commits changing deps to commits not changing deps. --- .circleci/config.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 67600e3386c8d..32e8324a879ea 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,10 +11,7 @@ aliases: restore_cache: name: Restore yarn cache for fixtures/dom keys: - - v1-yarn_cache-{{ arch }}-{{ checksum "yarn.lock" }}-fixtures/dom - - v1-yarn_cache-{{ arch }}-{{ checksum "yarn.lock" }} - - v1-yarn_cache-{{ arch }}- - - v1-yarn_cache- + - v2-yarn_cache-{{ arch }}-{{ checksum "yarn.lock" }}-fixtures/dom - &yarn_install_fixtures_dom run: @@ -32,7 +29,7 @@ aliases: - &save_yarn_cache_fixtures_dom save_cache: name: Save yarn cache for fixtures/dom - key: v1-yarn_cache-{{ arch }}-{{ checksum "yarn.lock" }}-fixtures/dom + key: v2-yarn_cache-{{ arch }}-{{ checksum "yarn.lock" }}-fixtures/dom paths: - ~/.cache/yarn @@ -48,9 +45,7 @@ commands: - restore_cache: name: Restore yarn cache keys: - - v1-yarn_cache-{{ arch }}-{{ checksum "yarn.lock" }} - - v1-yarn_cache-{{ arch }}- - - v1-yarn_cache- + - v2-yarn_cache-{{ arch }}-{{ checksum "yarn.lock" }} - run: name: Install dependencies command: | @@ -60,7 +55,7 @@ commands: fi - save_cache: name: Save yarn cache - key: v1-yarn_cache-{{ arch }}-{{ checksum "yarn.lock" }} + key: v2-yarn_cache-{{ arch }}-{{ checksum "yarn.lock" }} paths: - ~/.cache/yarn