Skip to content

Commit 86534c0

Browse files
build: vendor yarn using the .yarnrc yarn-path value (#18495)
* build: vendor yarn using the .yarnrc yarn-path value Rather than enforcing yarn versioning using `package.json`'s engines value. We can utilize yarn's `yarn-path` value to ensure that the version of yarn used at execution time is consistent for everyone who uses our repo. * fixup! build: vendor yarn using the .yarnrc yarn-path value
1 parent 2e939d4 commit 86534c0

File tree

7 files changed

+147405
-37
lines changed

7 files changed

+147405
-37
lines changed

.circleci/config.yml

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -71,30 +71,23 @@ var_11: &yarn_install_loose_lockfile
7171
name: "Installing project dependencies"
7272
command: yarn install --non-interactive
7373

74-
# Anchor that can be used to download and install Yarn globally in the bash environment.
75-
var_12: &yarn_download
76-
run:
77-
name: "Downloading and installing Yarn"
78-
command: |
79-
touch $BASH_ENV
80-
curl -o- -L https://yarnpkg.com/install.sh | PROFILE=$BASH_ENV bash -s -- --version "1.19.1"
8174
# Sets up the Bazel config which is specific for CircleCI builds.
82-
var_13: &setup_bazel_ci_config
75+
var_12: &setup_bazel_ci_config
8376
run:
8477
name: "Setting up Bazel configuration for CI"
8578
command: |
8679
echo "import %workspace%/.circleci/bazel.rc" >> ./.bazelrc
8780
8881
# Attaches the release output which has been stored in the workspace to the current job.
8982
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
90-
var_14: &attach_release_output
83+
var_13: &attach_release_output
9184
attach_workspace:
9285
at: dist/
9386

9487
# Branch filter that we can specify for jobs that should only run on publish branches. This filter
9588
# is used to ensure that not all upstream branches will be published as Github builds
9689
# (e.g. revert branches, feature branches)
97-
var_15: &publish_branches_filter
90+
var_14: &publish_branches_filter
9891
branches:
9992
only:
10093
- master
@@ -108,33 +101,33 @@ var_15: &publish_branches_filter
108101
# In order to reduce duplication we use a YAML anchor that just always excludes the "_presubmit"
109102
# branch. We don't want to run Circle for the temporary "_presubmit" branch which is reserved
110103
# for the caretaker.
111-
var_16: &ignore_presubmit_branch_filter
104+
var_15: &ignore_presubmit_branch_filter
112105
branches:
113106
ignore:
114107
- "_presubmit"
115108

116109
# Runs a script that sets up the Bazel remote execution. This will be used by jobs that run
117110
# Bazel primarily and should benefit from remote caching and execution.
118-
var_17: &setup_bazel_remote_execution
111+
var_16: &setup_bazel_remote_execution
119112
run:
120113
name: "Setup bazel RBE remote execution"
121114
command: ./scripts/circleci/bazel/setup-remote-execution.sh
122115

123116
# Sets up the bazel binary globally. We don't want to access bazel through Yarn and NodeJS
124117
# because it could mean that the Bazel child process only has access to limited memory.
125-
var_18: &setup_bazel_binary
118+
var_17: &setup_bazel_binary
126119
run:
127120
name: "Setting up global Bazel binary"
128121
command: ./scripts/circleci/setup_bazel_binary.sh
129122

130123
# Sets up the Angular snapshot builds.
131-
var_19: &setup_snapshot_builds
124+
var_18: &setup_snapshot_builds
132125
run:
133126
name: "Setting up Angular snapshot builds"
134127
command: node ./scripts/circleci/setup-angular-snapshots.js master
135128

136129
# Filter to skip a job on builds for pull requests.
137-
var_20: &skip_on_pull_requests_filter
130+
var_19: &skip_on_pull_requests_filter
138131
branches:
139132
ignore:
140133
- /pull\/\d+/
@@ -163,7 +156,6 @@ jobs:
163156
- *restore_cache
164157
- *setup_bazel_ci_config
165158
- *setup_bazel_remote_execution
166-
- *yarn_download
167159
- *yarn_install
168160
- *setup_bazel_binary
169161

@@ -185,7 +177,6 @@ jobs:
185177
- *restore_cache
186178
- *setup_bazel_ci_config
187179
- *setup_bazel_remote_execution
188-
- *yarn_download
189180
- *yarn_install
190181
- *setup_bazel_binary
191182

@@ -204,7 +195,6 @@ jobs:
204195
- *restore_cache
205196
- *setup_bazel_ci_config
206197
- *setup_bazel_remote_execution
207-
- *yarn_download
208198
- *yarn_install
209199
- *setup_bazel_binary
210200

@@ -224,7 +214,6 @@ jobs:
224214
- *restore_cache
225215
- *setup_bazel_ci_config
226216
- *setup_bazel_remote_execution
227-
- *yarn_download
228217
- *yarn_install
229218
- *setup_bazel_binary
230219

@@ -244,7 +233,6 @@ jobs:
244233
- *checkout_code
245234
- *restore_cache
246235
- *setup_bazel_ci_config
247-
- *yarn_download
248236
- *yarn_install
249237

250238
- run: ./scripts/circleci/run-browserstack-tests.sh
@@ -266,7 +254,6 @@ jobs:
266254
- *checkout_code
267255
- *restore_cache
268256
- *setup_bazel_ci_config
269-
- *yarn_download
270257
- *yarn_install
271258

272259
- run: ./scripts/circleci/run-saucelabs-tests.sh
@@ -280,7 +267,6 @@ jobs:
280267
- *checkout_code
281268
- *restore_cache
282269
- *setup_bazel_ci_config
283-
- *yarn_download
284270
- *yarn_install
285271
- *setup_bazel_binary
286272

@@ -317,7 +303,6 @@ jobs:
317303
- *restore_cache
318304
- *setup_bazel_ci_config
319305
- *setup_bazel_remote_execution
320-
- *yarn_download
321306
- *yarn_install
322307
- *setup_bazel_binary
323308

@@ -371,7 +356,6 @@ jobs:
371356
- *attach_release_output
372357
- *setup_bazel_ci_config
373358
- *setup_bazel_remote_execution
374-
- *yarn_download
375359
- *yarn_install
376360
- *setup_bazel_binary
377361

@@ -397,7 +381,6 @@ jobs:
397381
- *checkout_code
398382
- *restore_cache
399383
- *attach_release_output
400-
- *yarn_download
401384
- *yarn_install
402385

403386
- run: cp -R dist/releases/* node_modules/@angular/
@@ -414,7 +397,6 @@ jobs:
414397
- *checkout_code
415398
- *restore_cache
416399
- *attach_release_output
417-
- *yarn_download
418400
- *setup_snapshot_builds
419401
- *yarn_install_loose_lockfile
420402

@@ -435,7 +417,6 @@ jobs:
435417
- *restore_cache
436418
- *setup_bazel_ci_config
437419
- *setup_bazel_remote_execution
438-
- *yarn_download
439420
- *setup_snapshot_builds
440421
- *yarn_install_loose_lockfile
441422
- *setup_bazel_binary
@@ -456,7 +437,6 @@ jobs:
456437
- *restore_cache
457438
- *setup_bazel_ci_config
458439
- *setup_bazel_remote_execution
459-
- *yarn_download
460440
- *yarn_install
461441
- *setup_bazel_binary
462442

@@ -476,7 +456,6 @@ jobs:
476456
- *restore_cache
477457
- *setup_bazel_ci_config
478458
- *setup_bazel_remote_execution
479-
- *yarn_download
480459
- *setup_snapshot_builds
481460
- *yarn_install_loose_lockfile
482461
- *setup_bazel_binary
@@ -498,7 +477,6 @@ jobs:
498477
- *setup_bazel_binary
499478
- *setup_bazel_ci_config
500479
- *setup_bazel_remote_execution
501-
- *yarn_download
502480
- *yarn_install
503481

504482
# Install the latest canary version of the "material-components-web".

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@
241241

242242
# Tooling
243243
/.circleci/** @angular/dev-infra-components
244+
/.yarn/** @angular/dev-infra-components
244245
/scripts/** @angular/dev-infra-components
245246
/test/** @angular/dev-infra-components
246247
/tools/** @angular/dev-infra-components

.yarn/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Yarn Vendoring
2+
We utilize Yarn's `yarn-path` configuration in a shared `.yarnrc` file to enforce
3+
everyone using the same version of Yarn. Yarn checks the `.yarnrc` file to
4+
determine if yarn should delegate the command to a vendored version at the
5+
provided path.
6+
7+
## How to update
8+
To update to the latest version of Yarn as our vendored version:
9+
- Run this command
10+
```sh
11+
yarn policies set-version latest
12+
```
13+
- Remove the previous version

0 commit comments

Comments
 (0)