Skip to content

Commit 971d99f

Browse files
filipesilvavikerman
authored andcommitted
ci: use var to hold workspace location
1 parent eca5619 commit 971d99f

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

.circleci/config.yml

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ var_2: &cache_key_fallback angular_devkit-0.11.0
2121
var_1_win: &cache_key_win angular_devkit-win-0.11.0-{{ checksum "yarn.lock" }}
2222
var_2_win: &cache_key_fallback_win angular_devkit-win-0.11.0
2323
var_3: &default_nodeversion "12.1"
24-
var_4: &attach_options
25-
at: .
24+
# Workspace initially persisted by the `setup` job, and then enhanced by `setup-and-build-win`.
25+
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
26+
# https://circleci.com/blog/deep-diving-into-circleci-workspaces/
27+
var_4: &workspace_location .
28+
# Filter to ignore pull requests on a given job.
2629
var_5: &ignore_pull_requests
2730
filters:
2831
branches:
@@ -63,6 +66,11 @@ executors:
6366
# Command Definitions
6467
# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-commands
6568
commands:
69+
custom_attach_workspace:
70+
description: Attach workspace at a predefined location
71+
steps:
72+
- attach_workspace:
73+
at: *workspace_location
6674
setup_windows:
6775
steps:
6876
- run:
@@ -123,7 +131,7 @@ jobs:
123131
- *cache_key_fallback
124132
- run: yarn install --frozen-lockfile
125133
- persist_to_workspace:
126-
root: .
134+
root: *workspace_location
127135
paths:
128136
- ./*
129137
- save_cache:
@@ -134,7 +142,7 @@ jobs:
134142
lint:
135143
executor: action-executor
136144
steps:
137-
- attach_workspace: *attach_options
145+
- custom_attach_workspace
138146
- run: yarn lint
139147
- run: 'yarn bazel:format -mode=check ||
140148
(echo "BUILD files not formatted. Please run ''yarn bazel:format''" ; exit 1)'
@@ -145,13 +153,13 @@ jobs:
145153
validate:
146154
executor: action-executor
147155
steps:
148-
- attach_workspace: *attach_options
156+
- custom_attach_workspace
149157
- run: yarn validate --ci
150158

151159
test:
152160
executor: action-executor
153161
steps:
154-
- attach_workspace: *attach_options
162+
- custom_attach_workspace
155163
- run: yarn test --full
156164

157165
test-large:
@@ -166,7 +174,7 @@ jobs:
166174
resource_class: large
167175
parallelism: 4
168176
steps:
169-
- attach_workspace: *attach_options
177+
- custom_attach_workspace
170178
- run: yarn webdriver-update
171179
- run: yarn test-large --full <<# parameters.ivy >>--ivy<</ parameters.ivy >> <<# parameters.glob >>--glob="<< parameters.glob >>"<</ parameters.glob >> --nb-shards=${CIRCLE_NODE_TOTAL} --shard=${CIRCLE_NODE_INDEX}
172180

@@ -181,7 +189,7 @@ jobs:
181189
executor: test-executor
182190
parallelism: 4
183191
steps:
184-
- attach_workspace: *attach_options
192+
- custom_attach_workspace
185193
- run:
186194
name: Initialize Environment
187195
command: ./.circleci/env.sh
@@ -195,7 +203,7 @@ jobs:
195203
nodeversion: "10.12"
196204
parallelism: 4
197205
steps:
198-
- attach_workspace: *attach_options
206+
- custom_attach_workspace
199207
- run:
200208
name: Initialize Environment
201209
command: |
@@ -210,7 +218,7 @@ jobs:
210218
environment:
211219
E2E_BROWSERS: true
212220
steps:
213-
- attach_workspace: *attach_options
221+
- custom_attach_workspace
214222
- run:
215223
name: Initialize Environment
216224
command: ./.circleci/env.sh
@@ -230,15 +238,15 @@ jobs:
230238
build:
231239
executor: action-executor
232240
steps:
233-
- attach_workspace: *attach_options
241+
- custom_attach_workspace
234242
- run: yarn build
235243

236244
# This is where we put all the misbehaving and flaky tests so we can fine-tune their conditions
237245
# and rerun them faster.
238246
flake-jail:
239247
executor: action-executor
240248
steps:
241-
- attach_workspace: *attach_options
249+
- custom_attach_workspace
242250
- run: yarn webdriver-update
243251
- run: yarn test-large --full --flakey
244252
- run: yarn test-large --full --flakey --ivy=true
@@ -247,15 +255,15 @@ jobs:
247255
executor: action-executor
248256
resource_class: xlarge
249257
steps:
250-
- attach_workspace: *attach_options
258+
- custom_attach_workspace
251259
- setup_bazel_rbe
252260
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
253261
- run: yarn bazel:test
254262

255263
snapshot_publish:
256264
executor: action-executor
257265
steps:
258-
- attach_workspace: *attach_options
266+
- custom_attach_workspace
259267
- run:
260268
name: Decrypt Credentials
261269
# Note: when changing the image, you might have to re-encrypt the credentials with a
@@ -271,7 +279,7 @@ jobs:
271279
publish:
272280
executor: action-executor
273281
steps:
274-
- attach_workspace: *attach_options
282+
- custom_attach_workspace
275283
- run:
276284
name: Decrypt Credentials
277285
command: |
@@ -287,7 +295,7 @@ jobs:
287295
setup-and-build-win:
288296
executor: windows-executor
289297
steps:
290-
- attach_workspace: *attach_options
298+
- custom_attach_workspace
291299
- setup_windows
292300
- restore_cache:
293301
keys:
@@ -303,14 +311,14 @@ jobs:
303311
# Only jobs downstream from this one will see the updated workspace
304312
# https://circleci.com/blog/deep-diving-into-circleci-workspaces/
305313
- persist_to_workspace:
306-
root: .
314+
root: *workspace_location
307315
paths:
308316
- ./*
309317

310318
test-win:
311319
executor: windows-executor
312320
steps:
313-
- attach_workspace: *attach_options
321+
- custom_attach_workspace
314322
- setup_windows
315323
- run: yarn test --full
316324
# Run partial e2e suite on PRs only. Master will run the full e2e suite with sharding.

0 commit comments

Comments
 (0)