Skip to content

Commit 7021d31

Browse files
committed
build: invalidate circleci cache to prune unused nested node modules (#25512)
Yarn 1.x has a bug where it keeps nested unused node modules and doesn't delete them automatically. This throws off Bazel in some scenarios when the lock file is updated. This commit invalidates the cache to get a fresh clean node modules cache without any unused nested directories. (cherry picked from commit 7859dbb)
1 parent 1d64092 commit 7021d31

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ var_2: &docker-browser-image cimg/node:16.14.0-browsers
1313
# **Note**: When updating the beginning of the cache key, also update the cache key to match
1414
# the new cache key prefix. This allows us to take advantage of CircleCI's fallback caching.
1515
# Read more here: https://circleci.com/docs/2.0/caching/#restoring-cache.
16-
var_3: &cache_key v10-ng-mat-{{ checksum ".bazelversion" }}-{{ checksum "tools/postinstall/apply-patches.js" }}-{{ checksum "WORKSPACE" }}-{{ checksum "yarn.lock" }}
16+
var_3: &cache_key v11-ng-mat-{{ checksum ".bazelversion" }}-{{ checksum "tools/postinstall/apply-patches.js" }}-{{ checksum "WORKSPACE" }}-{{ checksum "yarn.lock" }}
1717
# We want to invalidate the cache if the postinstall patches change. In order to apply new
1818
# patches, a clean version of the node modules is needed. Additionally, we invalidate the cache
1919
# if the Bazel version changes. We do this because otherwise the `bazelisk` cache folder will
2020
# contain all previously used versions and ultimately cause the cache restoring to be slower.
21-
var_4: &cache_fallback_key v10-ng-mat-{{ checksum ".bazelversion" }}-{{ checksum "tools/postinstall/apply-patches.js" }}-
21+
var_4: &cache_fallback_key v11-ng-mat-{{ checksum ".bazelversion" }}-{{ checksum "tools/postinstall/apply-patches.js" }}-
2222

2323
# Settings common to each job
2424
var_5: &job_defaults

0 commit comments

Comments
 (0)