@@ -26,14 +26,6 @@ var_5: &job_defaults
26
26
docker :
27
27
- image : *docker_image
28
28
29
- # Job step for checking out the source code from GitHub. This also ensures that the source code
30
- # is rebased on top of master.
31
- var_6 : &checkout_code
32
- checkout :
33
- # After checkout, rebase on top of master. By default, PRs are not rebased on top of master,
34
- # which we want. See https://discuss.circleci.com/t/1662
35
- post : git pull --ff-only origin "refs/pull/${CI_PULL_REQUEST//*pull\//}/merge"
36
-
37
29
# Restores the cache that could be available for the current Yarn lock file. The cache usually
38
30
# includes the node modules and the Bazel repository cache.
39
31
var_7 : &restore_cache
@@ -159,12 +151,34 @@ orbs:
159
151
# push conflicts.
160
152
queue :
eddiewebb/[email protected]
161
153
154
+
155
+ commands :
156
+ checkout_and_rebase :
157
+ description : Checkout and rebase the repository
158
+ steps :
159
+ - checkout
160
+ - run :
161
+ name : Set up environment
162
+ environment :
163
+ CIRCLE_GIT_BASE_REVISION : << pipeline.git.base_revision >>
164
+ CIRCLE_GIT_REVISION : << pipeline.git.revision >>
165
+ command : ./.circleci/env.sh
166
+ - run :
167
+ name : Rebase PR on target branch
168
+ # After checkout, rebase on top of target branch.
169
+ command : |
170
+ if [ -n "$CIRCLE_PR_NUMBER" ]; then
171
+ # User is required for rebase.
172
+ git config user.name "angular-ci"
173
+ git config user.email "angular-ci"
174
+ node .circleci/rebase-pr.js
175
+ fi
176
+
162
177
# -----------------------------------------------------------------------------------------
163
178
# Job definitions. Jobs which are defined just here, will not run automatically. Each job
164
179
# must be part of a workflow definition in order to run for PRs and push builds.
165
180
# -----------------------------------------------------------------------------------------
166
181
jobs :
167
-
168
182
# -----------------------------------
169
183
# Job to test that everything builds with Bazel
170
184
# -----------------------------------
@@ -174,7 +188,7 @@ jobs:
174
188
environment :
175
189
GCP_DECRYPT_TOKEN : *gcp_decrypt_token
176
190
steps :
177
- - *checkout_code
191
+ - checkout_and_rebase
178
192
- *restore_cache
179
193
- *setup_bazel_ci_config
180
194
- *setup_bazel_remote_execution
@@ -196,7 +210,7 @@ jobs:
196
210
environment :
197
211
GCP_DECRYPT_TOKEN : *gcp_decrypt_token
198
212
steps :
199
- - *checkout_code
213
+ - checkout_and_rebase
200
214
- *restore_cache
201
215
- *setup_bazel_ci_config
202
216
- *setup_bazel_remote_execution
@@ -218,7 +232,7 @@ jobs:
218
232
environment :
219
233
GCP_DECRYPT_TOKEN : *gcp_decrypt_token
220
234
steps :
221
- - *checkout_code
235
+ - checkout_and_rebase
222
236
- *restore_cache
223
237
- *setup_bazel_ci_config
224
238
- *setup_bazel_remote_execution
@@ -237,7 +251,7 @@ jobs:
237
251
environment :
238
252
GCP_DECRYPT_TOKEN : *gcp_decrypt_token
239
253
steps :
240
- - *checkout_code
254
+ - checkout_and_rebase
241
255
- *restore_cache
242
256
- *setup_bazel_ci_config
243
257
- *setup_bazel_remote_execution
@@ -260,7 +274,7 @@ jobs:
260
274
environment :
261
275
GCP_DECRYPT_TOKEN : *gcp_decrypt_token
262
276
steps :
263
- - *checkout_code
277
+ - checkout_and_rebase
264
278
- *restore_cache
265
279
- *setup_bazel_ci_config
266
280
- *setup_bazel_remote_execution
@@ -281,7 +295,7 @@ jobs:
281
295
BROWSER_STACK_USERNAME : " angularteam1"
282
296
BROWSER_STACK_ACCESS_KEY : " CaXMeMHD9pr5PHg8N7Jq"
283
297
steps :
284
- - *checkout_code
298
+ - checkout_and_rebase
285
299
- *restore_cache
286
300
- *setup_bazel_ci_config
287
301
- *yarn_install
@@ -303,7 +317,7 @@ jobs:
303
317
# a rate limit exception.
304
318
KARMA_PARALLEL_BROWSERS : 2
305
319
steps :
306
- - *checkout_code
320
+ - checkout_and_rebase
307
321
- *restore_cache
308
322
- *setup_bazel_ci_config
309
323
- *yarn_install
@@ -316,8 +330,11 @@ jobs:
316
330
# ----------------------------------
317
331
lint :
318
332
<< : *job_defaults
333
+ environment :
334
+ CI_GIT_BASE_REVISION : << pipeline.git.base_revision >>
335
+ CI_GIT_REVISION : << pipeline.git.revision >>
319
336
steps :
320
- - *checkout_code
337
+ - checkout_and_rebase
321
338
- *restore_cache
322
339
- *setup_bazel_ci_config
323
340
- *yarn_install
@@ -342,7 +359,7 @@ jobs:
342
359
# much about any failures that have made it into the main branch.
343
360
command : |
344
361
if [ -n "$CIRCLE_PR_NUMBER" ]; then
345
- yarn ng-dev commit-message validate-range --range << pipeline.git.base_revision >>...<<pipeline.git.revision>>
362
+ yarn ng-dev commit-message validate-range --range $CI_COMMIT_RANGE
346
363
fi
347
364
- run : yarn ownerslint
348
365
- run : yarn stylelint
@@ -362,7 +379,7 @@ jobs:
362
379
environment :
363
380
GCP_DECRYPT_TOKEN : *gcp_decrypt_token
364
381
steps :
365
- - *checkout_code
382
+ - checkout_and_rebase
366
383
- *restore_cache
367
384
- *setup_bazel_ci_config
368
385
- *setup_bazel_remote_execution
@@ -414,7 +431,7 @@ jobs:
414
431
upload_release_packages :
415
432
<< : *job_defaults
416
433
steps :
417
- - *checkout_code
434
+ - checkout_and_rebase
418
435
- *restore_cache
419
436
- *attach_release_output
420
437
- *yarn_install
@@ -435,7 +452,7 @@ jobs:
435
452
environment :
436
453
GCP_DECRYPT_TOKEN : *gcp_decrypt_token
437
454
steps :
438
- - *checkout_code
455
+ - checkout_and_rebase
439
456
- *restore_cache
440
457
- *attach_release_output
441
458
- *setup_bazel_ci_config
@@ -473,7 +490,7 @@ jobs:
473
490
<< : *job_defaults
474
491
resource_class : xlarge
475
492
steps :
476
- - *checkout_code
493
+ - checkout_and_rebase
477
494
- *restore_cache
478
495
- *attach_release_output
479
496
- *yarn_install
@@ -497,7 +514,7 @@ jobs:
497
514
<< : *job_defaults
498
515
resource_class : xlarge
499
516
steps :
500
- - *checkout_code
517
+ - checkout_and_rebase
501
518
- *restore_cache
502
519
- *attach_release_output
503
520
- *setup_snapshot_builds
@@ -524,7 +541,7 @@ jobs:
524
541
environment :
525
542
GCP_DECRYPT_TOKEN : *gcp_decrypt_token
526
543
steps :
527
- - *checkout_code
544
+ - checkout_and_rebase
528
545
- *restore_cache
529
546
- *setup_bazel_ci_config
530
547
- *setup_bazel_remote_execution
@@ -545,7 +562,7 @@ jobs:
545
562
environment :
546
563
GCP_DECRYPT_TOKEN : *gcp_decrypt_token
547
564
steps :
548
- - *checkout_code
565
+ - checkout_and_rebase
549
566
- *restore_cache
550
567
- *setup_bazel_ci_config
551
568
- *setup_bazel_remote_execution
@@ -565,7 +582,7 @@ jobs:
565
582
environment :
566
583
GCP_DECRYPT_TOKEN : *gcp_decrypt_token
567
584
steps :
568
- - *checkout_code
585
+ - checkout_and_rebase
569
586
- *restore_cache
570
587
- *setup_bazel_ci_config
571
588
- *setup_bazel_remote_execution
@@ -586,7 +603,7 @@ jobs:
586
603
environment :
587
604
GCP_DECRYPT_TOKEN : *gcp_decrypt_token
588
605
steps :
589
- - *checkout_code
606
+ - checkout_and_rebase
590
607
- *restore_cache
591
608
- *setup_bazel_ci_config
592
609
- *setup_bazel_remote_execution
@@ -612,7 +629,7 @@ jobs:
612
629
environment :
613
630
GCP_DECRYPT_TOKEN : *gcp_decrypt_token
614
631
steps :
615
- - *checkout_code
632
+ - checkout_and_rebase
616
633
- *restore_cache
617
634
- *setup_bazel_binary
618
635
- *setup_bazel_ci_config
0 commit comments