Skip to content

Commit 685075e

Browse files
authored
feat(mozcloud-publish): updated mozcloud-publish workflow to trigger on tokenserver-preview labels and consolidated checks into a job that is required by all build jobs (#2135)
1 parent 5dbe6bc commit 685075e

File tree

1 file changed

+23
-72
lines changed

1 file changed

+23
-72
lines changed

.github/workflows/mozcloud-publish.yaml

Lines changed: 23 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ on:
1818
workflow_dispatch: {}
1919

2020
jobs:
21-
# Note: we are moving towards renaming all images `syncserver`, the union of sync and tokenserver.
22-
# This presently remains for the time being to simplify deploys by maintaining `image_name: syncstorage-rs`.
23-
# Historical context: <https://github.com/mozilla-services/syncstorage-rs/pull/1306>
24-
build-and-push-syncstorage-rs:
21+
# Note: the check job only contains all of the requirements for running the following build workflows.
22+
# This consolidates our build checks into a single place.
23+
check:
2524
if: >
2625
github.event_name == 'workflow_dispatch' ||
2726
(
@@ -30,9 +29,21 @@ jobs:
3029
) ||
3130
(
3231
github.event_name == 'pull_request' &&
33-
contains(github.event.pull_request.labels.*.name, 'preview') &&
34-
github.event.pull_request.head.repo.full_name == github.repository
32+
github.event.pull_request.head.repo.full_name == github.repository &&
33+
(
34+
contains(github.event.pull_request.labels.*.name, 'preview') ||
35+
contains(github.event.pull_request.labels.*.name, 'tokenserver-preview')
36+
)
3537
)
38+
runs-on: ubuntu-latest
39+
steps:
40+
- run: echo "Conditions met, proceeding with build jobs"
41+
42+
# Note: we are moving towards renaming all images `syncserver`, the union of sync and tokenserver.
43+
# This presently remains for the time being to simplify deploys by maintaining `image_name: syncstorage-rs`.
44+
# Historical context: <https://github.com/mozilla-services/syncstorage-rs/pull/1306>
45+
build-and-push-syncstorage-rs:
46+
needs: check
3647
permissions:
3748
contents: read
3849
id-token: write
@@ -48,17 +59,7 @@ jobs:
4859
should_tag_ghcr: true
4960

5061
build-and-push-syncserver-postgres:
51-
if: >
52-
github.event_name == 'workflow_dispatch' ||
53-
(
54-
github.event_name == 'push' &&
55-
(github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/'))
56-
) ||
57-
(
58-
github.event_name == 'pull_request' &&
59-
contains(github.event.pull_request.labels.*.name, 'preview') &&
60-
github.event.pull_request.head.repo.full_name == github.repository
61-
)
62+
needs: check
6263
permissions:
6364
contents: read
6465
id-token: write
@@ -74,17 +75,7 @@ jobs:
7475
should_tag_ghcr: true
7576

7677
build-and-push-syncserver-postgres-enterprise-gar:
77-
if: >
78-
github.event_name == 'workflow_dispatch' ||
79-
(
80-
github.event_name == 'push' &&
81-
(github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/'))
82-
) ||
83-
(
84-
github.event_name == 'pull_request' &&
85-
contains(github.event.pull_request.labels.*.name, 'preview') &&
86-
github.event.pull_request.head.repo.full_name == github.repository
87-
)
78+
needs: check
8879
permissions:
8980
contents: read
9081
id-token: write
@@ -102,17 +93,7 @@ jobs:
10293
# This presently remains for the time being to simplify deploys by maintaining `image_name: syncstorage-rs-spanner-python-utils`.
10394
# Historical context: <https://github.com/mozilla-services/syncstorage-rs/pull/1306>
10495
build-and-push-syncstorage-rs-spanner-python-utils:
105-
if: >
106-
github.event_name == 'workflow_dispatch' ||
107-
(
108-
github.event_name == 'push' &&
109-
(github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/'))
110-
) ||
111-
(
112-
github.event_name == 'pull_request' &&
113-
contains(github.event.pull_request.labels.*.name, 'preview') &&
114-
github.event.pull_request.head.repo.full_name == github.repository
115-
)
96+
needs: check
11697
permissions:
11798
contents: read
11899
id-token: write
@@ -127,17 +108,7 @@ jobs:
127108
should_tag_ghcr: true
128109

129110
build-and-push-syncserver-postgres-python-utils:
130-
if: >
131-
github.event_name == 'workflow_dispatch' ||
132-
(
133-
github.event_name == 'push' &&
134-
(github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/'))
135-
) ||
136-
(
137-
github.event_name == 'pull_request' &&
138-
contains(github.event.pull_request.labels.*.name, 'preview') &&
139-
github.event.pull_request.head.repo.full_name == github.repository
140-
)
111+
needs: check
141112
permissions:
142113
contents: read
143114
id-token: write
@@ -152,17 +123,7 @@ jobs:
152123
should_tag_ghcr: true
153124

154125
build-and-push-syncserver-postgres-python-utils-enterprise-gar:
155-
if: >
156-
github.event_name == 'workflow_dispatch' ||
157-
(
158-
github.event_name == 'push' &&
159-
(github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/'))
160-
) ||
161-
(
162-
github.event_name == 'pull_request' &&
163-
contains(github.event.pull_request.labels.*.name, 'preview') &&
164-
github.event.pull_request.head.repo.full_name == github.repository
165-
)
126+
needs: check
166127
permissions:
167128
contents: read
168129
id-token: write
@@ -176,17 +137,7 @@ jobs:
176137
image_build_context: tools/postgres
177138

178139
build-and-push-syncserver-mysql:
179-
if: >
180-
github.event_name == 'workflow_dispatch' ||
181-
(
182-
github.event_name == 'push' &&
183-
(github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/'))
184-
) ||
185-
(
186-
github.event_name == 'pull_request' &&
187-
contains(github.event.pull_request.labels.*.name, 'preview') &&
188-
github.event.pull_request.head.repo.full_name == github.repository
189-
)
140+
needs: check
190141
permissions:
191142
contents: read
192143
id-token: write

0 commit comments

Comments
 (0)