Skip to content

Commit 1115961

Browse files
filipesilvaatscott
authored and
atscott
committed
ci: keep cache key fallback in a var (angular#32745)
This way it's right next to the original key and it's easier to keep them in sync. PR Close angular#32745
1 parent 6db5c4a commit 1115961

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

.circleci/config.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,17 @@ version: 2.1
1818
# cache changes. For example:
1919
# 1) yarn lock file changes --> cached "node_modules" are different.
2020
# 2) bazel repository definitions change --> cached bazel repositories are different.
21-
# **NOTE 1 **: If you change the cache key prefix, also sync the restore_cache fallback to match.
21+
# Windows needs its own cache key because binaries in node_modules are different.
22+
# **NOTE 1 **: If you change the cache key prefix, also sync the cache_key_fallback to match.
2223
# **NOTE 2 **: Keep the static part of the cache key as prefix to enable correct fallbacks.
2324
# See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI.
2425
var_3: &cache_key v3-angular-node-10.16-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "packages/bazel/package.bzl" }}-{{ checksum "aio/yarn.lock" }}
26+
var_4: &cache_key_fallback v3-angular-node-10.16-
2527
var_3_win: &cache_key_win v4-angular-win-node-12.0-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "packages/bazel/package.bzl" }}-{{ checksum "aio/yarn.lock" }}
28+
var_4_win: &cache_key_win_fallback v4-angular-win-node-12.0-
2629

2730
# Initializes the CI environment by setting up common environment variables.
28-
var_4: &init_environment
31+
var_5: &init_environment
2932
run:
3033
name: Initializing environment (setting up variables, overwriting Yarn)
3134
# Overwrite the yarn installed in the docker container with our own version.
@@ -50,7 +53,7 @@ var_4_win: &init_environment_win
5053
name: Setup windows node environment
5154
command: ./.circleci/windows-env.ps1
5255

53-
var_5: &setup_bazel_remote_execution
56+
var_6: &setup_bazel_remote_execution
5457
run:
5558
name: "Setup bazel RBE remote execution"
5659
command: |
@@ -112,14 +115,12 @@ var_10: &restore_cache
112115
restore_cache:
113116
keys:
114117
- *cache_key
115-
# This fallback should be the cache_key without variables.
116-
- v3-angular-node-10.16-
118+
- *cache_key_fallback
117119
var_10_win: &restore_cache_win
118120
restore_cache:
119121
keys:
120122
- *cache_key_win
121-
# This fallback should be the cache_key without variables.
122-
- v4-angular-win-node-12.0-
123+
- *cache_key_fallback_win
123124

124125
# Branch filter that can be specified for jobs that should only run on publish branches
125126
# (e.g. master or the patch branch)

0 commit comments

Comments
 (0)