Skip to content

Commit b68ae0d

Browse files
authored
build: avoid conflicts when publishing snapshot builds (#19737)
For the past year, we've had CI failures when multiple PRs have been merged. Since we run CI for all landed commits, the snapshot publish job runs multiple times concurrently and could end up pushing to the snapshot repositories out of order. This can result in conflicts when multiple jobs push artifacts at the same time. e.g. https://circleci.com/gh/angular/components/155407. We intend to fix this by queuing snapshot publishing across CircleCI builds. This is done using the CircleCI API. We constantly check the API to check that there are no previous snapshot jobs running. Instead of implementing this logic our own, we leverage a CircleCI orb that provides this functionality.
1 parent cc36af7 commit b68ae0d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

.circleci/config.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,15 @@ var_21: &slack_notify_on_failure
150150
# -----------------------------
151151
version: 2.1
152152

153+
# Configures CircleCI orbs for this pipeline. Orbs allow consumption of publicly shared
154+
# CircleCI commands, jobs, configuration elements or executors. Read more about orbs here:
155+
# https://circleci.com/docs/2.0/orb-intro/
156+
orbs:
157+
# Set up the `queue` orb that allows us to queue up builds across jobs. We use it
158+
# to make sure that snapshot builds are not deployed out of order, resulting in Git
159+
# push conflicts.
160+
queue: eddiewebb/[email protected]
161+
153162
# -----------------------------------------------------------------------------------------
154163
# Job definitions. Jobs which are defined just here, will not run automatically. Each job
155164
# must be part of a workflow definition in order to run for PRs and push builds.
@@ -427,6 +436,11 @@ jobs:
427436
# as part of this job to the docs-content repository. It's not contained in the
428437
# attached release output, so we need to build it here.
429438
- run: bazel build src/components-examples:npm_package --config=release
439+
440+
# Ensures that we do not push the snapshot artifacts upstream until all previous
441+
# snapshot build jobs have completed. This helps avoiding conflicts when multiple
442+
# commits have been pushed (resulting in multiple concurrent snapshot publish jobs).
443+
- queue/until_front_of_line
430444
- run: ./scripts/circleci/publish-snapshots.sh
431445
- *slack_notify_on_failure
432446

0 commit comments

Comments
 (0)