Skip to content

Commit 528dff5

Browse files
devversionjelbourn
authored andcommitted
build: fix circleci branch filter not working (#14583)
1 parent fe0c2a8 commit 528dff5

File tree

1 file changed

+41
-20
lines changed

1 file changed

+41
-20
lines changed

.circleci/config.yml

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,29 @@ var_10: &attach_release_output
6565
attach_workspace:
6666
at: dist/releases
6767

68+
69+
# Branch filter that we can specify for jobs that should only run on publish branches. This filter
70+
# is used to ensure that not all upstream branches will be published as Github builds
71+
# (e.g. revert branches, feature branches)
72+
var_11: &publish_branches_filter
73+
branches:
74+
only:
75+
- master
76+
# 6.0.x, 7.1.x, etc.
77+
- /\d+\.\d+\.x/
78+
# 6.x, 7.x, 8.x etc
79+
- /\d+\.x/
80+
81+
# Branch filter that is usually applied to all jobs. Since there is no way within CircleCI to
82+
# exclude a branch for all defined jobs, we need to manually specify the filters for each job.
83+
# In order to reduce duplication we use a YAML anchor that just always excludes the "_presubmit"
84+
# branch. We don't want to run Circle for the temporary "_presubmit" branch which is reserved
85+
# for the caretaker.
86+
var_12: &ignore_presubmit_branch_filter
87+
branches:
88+
ignore:
89+
- "_presubmit"
90+
6891
# -----------------------------
6992
# Container version of CircleCI
7093
# -----------------------------
@@ -308,34 +331,44 @@ workflows:
308331
# that build and test source code should be part of this workflow
309332
build_and_test:
310333
jobs:
311-
- bazel_build_test
312-
- api_golden_checks
334+
- bazel_build_test:
335+
filters: *ignore_presubmit_branch_filter
336+
- api_golden_checks:
337+
filters: *ignore_presubmit_branch_filter
313338

314339
unit_tests:
315340
jobs:
316-
- tests_local_browsers
317-
- tests_browserstack
318-
- tests_saucelabs
341+
- tests_local_browsers:
342+
filters: *ignore_presubmit_branch_filter
343+
- tests_browserstack:
344+
filters: *ignore_presubmit_branch_filter
345+
- tests_saucelabs:
346+
filters: *ignore_presubmit_branch_filter
319347

320348
integration_tests:
321349
jobs:
322-
- e2e_tests
323-
- prerender_build
350+
- e2e_tests:
351+
filters: *ignore_presubmit_branch_filter
352+
- prerender_build:
353+
filters: *ignore_presubmit_branch_filter
324354

325355
release_output:
326356
jobs:
327357
- build_release_packages
328358
- build_devapp_aot:
359+
filters: *ignore_presubmit_branch_filter
329360
requires:
330361
- build_release_packages
331362
- publish_snapshots:
363+
filters: *publish_branches_filter
332364
requires:
333365
- build_release_packages
334366

335367
# Lint workflow. As we want to lint in one job, this is a workflow with just one job.
336368
lint:
337369
jobs:
338-
- lint
370+
- lint:
371+
filters: *ignore_presubmit_branch_filter
339372

340373
# Snapshot tests workflow that is scheduled to run all specified jobs at midnight everyday.
341374
# This workflow runs various jobs against the Angular snapshot builds from Github.
@@ -355,15 +388,3 @@ workflows:
355388
# it's not guaranteed that older versions of Angular Material always work
356389
# with the latest Angular version.
357390
- master
358-
359-
# ---------------------------
360-
# General setup for CircleCI
361-
# ---------------------------
362-
general:
363-
branches:
364-
only:
365-
- master
366-
# 5.2.x, 6.0.x, etc
367-
- /\d+\.\d+\.x/
368-
# 5.x, 6.x, etc
369-
- /\d+\.x/

0 commit comments

Comments
 (0)