Skip to content

Commit

Permalink
CircleCI: Replace some references to master with origin or origin/HEAD (
Browse files Browse the repository at this point in the history
#43941)

* Replace some references to master with origin or origin/HEAD

In many cases, `origin` just by itself is an alias for origin/HEAD.
When a specific branch name is needed, such as in the case of the
CI caches changed in this commit, we can use HEAD as a direct
alias for the primary branch, regardless of to what it is currently
set.

* CircleCI: Go ahead and use new branch name for caches
  • Loading branch information
sarayourfriend authored Jul 13, 2020
1 parent adcf46e commit 4a42e6d
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ references:
# When we split tests, different nodes will receive a different set of tests so each node's
# cache should be unique.
#
# Finally, we cache on the branch and revision, falling back to master. This should give us
# Finally, we cache on the branch and revision, falling back to origin/HEAD. This should give us
# pretty good "nearest neighbor" primer for the Jest cache.
#
# More about the CircleCI cache: https://circleci.com/docs/2.0/caching
Expand All @@ -62,7 +62,7 @@ references:
keys:
- v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v8-jest-{{ .Environment.CIRCLE_JOB }}-{{ .Environment.CIRCLE_NODE_INDEX }}/{{ .Environment.CIRCLE_NODE_TOTAL }}-{{ .Branch }}-{{ .Revision }}
- v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v8-jest-{{ .Environment.CIRCLE_JOB }}-{{ .Environment.CIRCLE_NODE_INDEX }}/{{ .Environment.CIRCLE_NODE_TOTAL }}-{{ .Branch }}
- v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v8-jest-{{ .Environment.CIRCLE_JOB }}-{{ .Environment.CIRCLE_NODE_INDEX }}/{{ .Environment.CIRCLE_NODE_TOTAL }}-master
- v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v8-jest-{{ .Environment.CIRCLE_JOB }}-{{ .Environment.CIRCLE_NODE_INDEX }}/{{ .Environment.CIRCLE_NODE_TOTAL }}-trunk
- v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v8-jest-{{ .Environment.CIRCLE_JOB }}-{{ .Environment.CIRCLE_NODE_INDEX }}/{{ .Environment.CIRCLE_NODE_TOTAL }}
save-jest-cache: &save-jest-cache
name: Save Jest cache
Expand All @@ -78,7 +78,7 @@ references:
keys:
- v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v0-terser-{{ .Branch }}-{{ .Revision }}
- v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v0-terser-{{ .Branch }}
- v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v0-terser-master
- v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v0-terser-trunk
- v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v0-terser
save-terser-cache: &save-terser-cache
name: Save Terser cache
Expand All @@ -92,19 +92,19 @@ references:
# By including the `.git` directory in the cache, we can speed things up by only needing to update
# the local repository.
#
# We cache on the branch and revision, falling back to master, or any recent cache.
# We cache on the branch and revision, falling back to origin/HEAD, or any recent cache.
#
# More about the CircleCI cache: https://circleci.com/docs/2.0/caching
restore-git-cache: &restore-git-cache
name: Restore git cache
keys:
- v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v2-git-{{ .Branch }}-{{ .Revision }}
- v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v2-git-{{ .Branch }}
- v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v2-git-master
- v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v2-git-trunk
- v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v2-git
update-git-master: &update-git-master
name: Update master branch
command: git fetch --force origin master
update-git: &update-git
name: Update all branches
command: git fetch --force origin
save-git-cache: &save-git-cache
name: Save git cache
key: v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v2-git-{{ .Branch }}-{{ .Revision }}
Expand Down Expand Up @@ -170,7 +170,7 @@ references:
keys:
- v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v1-babel-client-{{ .Branch }}-{{ .Revision }}
- v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v1-babel-client-{{ .Branch }}
- v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v1-babel-client-master
- v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v1-babel-client-trunk
- v{{ .Environment.GLOBAL_CACHE_PREFIX }}-v1-babel-client
save-babel-client-cache: &save-babel-client-cache
name: Save Babel Client Cache
Expand Down Expand Up @@ -260,7 +260,7 @@ jobs:
# repo
- restore_cache: *restore-git-cache
- checkout
- run: *update-git-master
- run: *update-git
- save_cache: *save-git-cache
- run: *update-node
# npm dependencies
Expand Down Expand Up @@ -309,7 +309,7 @@ jobs:
# We may not have files to lint which returns non-0 exit
# Ensure this does not cause job failure (see `|| exit 0`)
FILES_TO_LINT=$(
git diff --name-only --diff-filter=d origin/master... \
git diff --name-only --diff-filter=d origin... \
| grep -E '^(client/|server/|packages/)' \
| grep -E '\.[jt]sx?$'
) || exit 0
Expand Down Expand Up @@ -507,7 +507,7 @@ jobs:
#
# Expected usage:
# - After setup
# - Only on branches (!master)
# - Only on branches (not the primary branch)
#
prime-calypso-live:
docker:
Expand Down

0 comments on commit 4a42e6d

Please sign in to comment.