ci: keep cache key fallback in a var (#32745)
This way it's right next to the original key and it's easier to keep them in sync. PR Close #32745
This commit is contained in:
@ -18,14 +18,17 @@ version: 2.1
|
|||||||
# cache changes. For example:
|
# cache changes. For example:
|
||||||
# 1) yarn lock file changes --> cached "node_modules" are different.
|
# 1) yarn lock file changes --> cached "node_modules" are different.
|
||||||
# 2) bazel repository definitions change --> cached bazel repositories are different.
|
# 2) bazel repository definitions change --> cached bazel repositories are different.
|
||||||
# **NOTE 1 **: If you change the cache key prefix, also sync the restore_cache fallback to match.
|
# Windows needs its own cache key because binaries in node_modules are different.
|
||||||
|
# **NOTE 1 **: If you change the cache key prefix, also sync the cache_key_fallback to match.
|
||||||
# **NOTE 2 **: Keep the static part of the cache key as prefix to enable correct fallbacks.
|
# **NOTE 2 **: Keep the static part of the cache key as prefix to enable correct fallbacks.
|
||||||
# See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI.
|
# See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI.
|
||||||
var_3: &cache_key v3-angular-node-10.16-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "packages/bazel/package.bzl" }}-{{ checksum "aio/yarn.lock" }}
|
var_3: &cache_key v3-angular-node-10.16-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "packages/bazel/package.bzl" }}-{{ checksum "aio/yarn.lock" }}
|
||||||
|
var_4: &cache_key_fallback v3-angular-node-10.16-
|
||||||
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" }}
|
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" }}
|
||||||
|
var_4_win: &cache_key_win_fallback v4-angular-win-node-12.0-
|
||||||
|
|
||||||
# Initializes the CI environment by setting up common environment variables.
|
# Initializes the CI environment by setting up common environment variables.
|
||||||
var_4: &init_environment
|
var_5: &init_environment
|
||||||
run:
|
run:
|
||||||
name: Initializing environment (setting up variables, overwriting Yarn)
|
name: Initializing environment (setting up variables, overwriting Yarn)
|
||||||
# Overwrite the yarn installed in the docker container with our own version.
|
# Overwrite the yarn installed in the docker container with our own version.
|
||||||
@ -50,7 +53,7 @@ var_4_win: &init_environment_win
|
|||||||
name: Setup windows node environment
|
name: Setup windows node environment
|
||||||
command: ./.circleci/windows-env.ps1
|
command: ./.circleci/windows-env.ps1
|
||||||
|
|
||||||
var_5: &setup_bazel_remote_execution
|
var_6: &setup_bazel_remote_execution
|
||||||
run:
|
run:
|
||||||
name: "Setup bazel RBE remote execution"
|
name: "Setup bazel RBE remote execution"
|
||||||
command: |
|
command: |
|
||||||
@ -112,14 +115,12 @@ var_10: &restore_cache
|
|||||||
restore_cache:
|
restore_cache:
|
||||||
keys:
|
keys:
|
||||||
- *cache_key
|
- *cache_key
|
||||||
# This fallback should be the cache_key without variables.
|
- *cache_key_fallback
|
||||||
- v3-angular-node-10.16-
|
|
||||||
var_10_win: &restore_cache_win
|
var_10_win: &restore_cache_win
|
||||||
restore_cache:
|
restore_cache:
|
||||||
keys:
|
keys:
|
||||||
- *cache_key_win
|
- *cache_key_win
|
||||||
# This fallback should be the cache_key without variables.
|
- *cache_key_fallback_win
|
||||||
- v4-angular-win-node-12.0-
|
|
||||||
|
|
||||||
# Branch filter that can be specified for jobs that should only run on publish branches
|
# Branch filter that can be specified for jobs that should only run on publish branches
|
||||||
# (e.g. master or the patch branch)
|
# (e.g. master or the patch branch)
|
||||||
|
Reference in New Issue
Block a user