Repository navigation
475 lines (449 loc) · 18.4 KB
/
Copy pathci-merge-queue.yml
File metadata and controls
475 lines (449 loc) · 18.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
# Copyright 2021 Collate
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: ci-merge-queue
on:
merge_group: null
workflow_dispatch:
inputs:
workload:
description: Queue checks to run manually
type: choice
options: [all, python, java, ui, data-access-request]
default: all
store-database-version:
description: Metadata store MySQL version, shipped or oldest
type: choice
options: [shipped, oldest]
default: shipped
permissions:
contents: read
packages: read
pull-requests: read
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}-${{ inputs.workload }}-${{ inputs.store-database-version }}
cancel-in-progress: true
jobs:
plan:
uses: ./.github/workflows/reusable-ci-plan.yml
with:
entrypoint: merge-queue
backend:
name: Build backend image
needs: plan
if: ${{ needs.plan.outputs.python == 'true' || needs.plan.outputs.airflow-apis == 'true' || needs.plan.outputs.docker-smoke == 'true' }}
uses: ./.github/workflows/reusable-build-backend.yml
with:
ref: ${{ needs.plan.outputs.ref }}
py-static-checks:
name: py-static-checks
needs: plan
if: ${{ needs.plan.outputs.static == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ needs.plan.outputs.ref }}
persist-credentials: false
fetch-depth: 1
- name: Run Python static checks
uses: ./.github/actions/python-static-checks
with:
python-version: ${{ needs.plan.outputs.python-lowest }}
check-types: ${{ needs.plan.outputs.python }}
prepare-classification-models:
needs: plan
if: ${{ needs.plan.outputs.python == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ needs.plan.outputs.ref }}
persist-credentials: false
fetch-depth: 1
sparse-checkout: |
scripts/prepare_classification_models.py
ingestion/pyproject.toml
.github/actions/prepare-classification-models
.github/actions/prepare-classification-model
sparse-checkout-cone-mode: false
- uses: ./.github/actions/prepare-classification-models
python-unit:
needs:
- plan
- prepare-classification-models
if: ${{ needs.plan.outputs.python == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ needs.plan.outputs.ref }}
persist-credentials: false
fetch-depth: 1
- name: Run Python unit tests
uses: ./.github/actions/python-unit
with:
python-version: ${{ needs.plan.outputs.python-highest }}
python-integration:
needs:
- plan
- prepare-classification-models
- backend
if: ${{ needs.plan.outputs.python == 'true' }}
uses: ./.github/workflows/reusable-py-integration.yml
with:
python-version: ${{ needs.plan.outputs.python-highest }}
ref: ${{ needs.plan.outputs.ref }}
source-database-version: newest
collect-coverage: false
airflow-apis:
needs: [plan, backend]
if: ${{ needs.plan.outputs.airflow-apis == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ needs.plan.outputs.ref }}
persist-credentials: false
fetch-depth: 1
- name: Run Airflow API tests
uses: ./.github/actions/python-airflow-apis
with:
python-version: ${{ needs.plan.outputs.python-lowest }}
use-backend-image: 'true'
py-tests-status:
name: py-tests-status
needs:
- plan
- airflow-apis
- py-static-checks
- prepare-classification-models
- python-unit
- python-integration
if: ${{ always() && (github.event_name == 'merge_group' || inputs.workload == 'all' || inputs.workload == 'python') }}
runs-on: ubuntu-slim
timeout-minutes: 2
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
sparse-checkout: .github/actions/ci-status-gate
- uses: ./.github/actions/ci-status-gate
with:
needs: ${{ toJSON(needs) }}
expected: |
{
"plan": "success",
"airflow-apis": "${{ needs.plan.outputs.airflow-apis == 'true' && 'success' || 'skipped' }}",
"py-static-checks": "${{ needs.plan.outputs.static == 'true' && 'success' || 'skipped' }}",
"prepare-classification-models": "${{ needs.plan.outputs.python == 'true' && 'success' || 'skipped' }}",
"python-unit": "${{ needs.plan.outputs.python == 'true' && 'success' || 'skipped' }}",
"python-integration": "${{ needs.plan.outputs.python == 'true' && 'success' || 'skipped' }}"
}
# UI runs as one job, like python: ui-ci.yml runs checkstyle and then fans
# Jest and the browser tests out to parallel shards.
ui:
name: ui
needs: plan
if: ${{ needs.plan.outputs.ui == 'true' }}
permissions:
contents: read
# The browser tests download the impact map from earlier runs.
actions: read
uses: ./.github/workflows/ui-ci.yml
with:
unit: ${{ needs.plan.outputs.ui-unit == 'true' }}
# Required check for the UI. It runs even when ui is skipped, so the check is
# always reported.
ui-tests-status:
name: ui-tests-status
needs: [plan, ui]
if: ${{ always() && (github.event_name == 'merge_group' || inputs.workload == 'all' || inputs.workload == 'ui') }}
runs-on: ubuntu-slim
timeout-minutes: 2
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
sparse-checkout: .github/actions/ci-status-gate
- uses: ./.github/actions/ci-status-gate
with:
needs: ${{ toJSON(needs) }}
expected: |
{
"plan": "success",
"ui": "${{ needs.plan.outputs.ui == 'true' && 'success' || 'skipped' }}"
}
# TEMPORARY: the merge-rules ruleset still requires these two names. Remove
# both once it requires ui-tests-status instead.
ui-checkstyle:
name: ui-checkstyle
needs: ui-tests-status
if: ${{ always() && (github.event_name == 'merge_group' || inputs.workload == 'all' || inputs.workload == 'ui') }}
runs-on: ubuntu-slim
timeout-minutes: 2
steps:
- run: test "${{ needs.ui-tests-status.result }}" = success
ui-coverage:
name: ui-coverage
needs: ui-tests-status
if: ${{ always() && (github.event_name == 'merge_group' || inputs.workload == 'all' || inputs.workload == 'ui') }}
runs-on: ubuntu-slim
timeout-minutes: 2
steps:
- run: test "${{ needs.ui-tests-status.result }}" = success
backend-checks:
runs-on: ubuntu-latest
timeout-minutes: 90
needs: plan
if: ${{ needs.plan.outputs.checkstyle == 'true' }}
steps:
- name: Checkout
id: checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ needs.plan.outputs.ref }}
persist-credentials: false
- name: Hydrate Maven dependencies
uses: ./.github/actions/hydrate-maven-cache
- name: Set up JDK 21
uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6
with:
java-version: "21"
distribution: "temurin"
# Fail-fast checkstyle: if formatting fails, skip unit tests and report
# the exact files in the summary below.
- name: "1/2: Java checkstyle"
id: checkstyle
uses: ./.github/actions/java-checkstyle
- name: "2/2: Service unit tests"
id: unit-tests
if: ${{ steps.checkstyle.outcome == 'success' && needs.plan.outputs.java-unit == 'true' }}
uses: ./.github/actions/java-service-unit-tests
- name: Summarize backend checks
if: ${{ always() && steps.checkout.outcome == 'success' }}
uses: ./.github/actions/java-backend-report
with:
checkstyle-outcome: ${{ steps.checkstyle.outcome }}
unit-tests-outcome: ${{ steps.unit-tests.outcome }}
k8s_operator-unit-tests:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: plan
if: ${{ needs.plan.outputs.java-operator == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ needs.plan.outputs.ref }}
persist-credentials: false
- name: Hydrate Maven dependencies
uses: ./.github/actions/hydrate-maven-cache
- name: Set up JDK 21
uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880 # v6
with:
java-version: "21"
distribution: "temurin"
- name: Run Kubernetes operator unit tests
uses: ./.github/actions/java-k8s-operator-tests
docker-image-smoke-test:
runs-on: ubuntu-latest
timeout-minutes: 60
needs: [plan, backend]
if: ${{ needs.plan.outputs.docker-smoke == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ needs.plan.outputs.ref }}
persist-credentials: false
- name: Smoke test the server image
uses: ./.github/actions/java-docker-smoke
integration-test-build:
name: Build Integration Test Runtime
runs-on: ubuntu-latest
timeout-minutes: 60
needs: plan
if: ${{ needs.plan.outputs.java-it == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ needs.plan.outputs.ref }}
persist-credentials: false
- name: Build the Java integration test runtime
uses: ./.github/actions/java-integration-build
it-mysql-elasticsearch:
needs: [plan, backend-checks, integration-test-build]
if: >-
!cancelled() &&
needs.plan.result == 'success' &&
needs.plan.outputs.java-it == 'true' &&
(needs.backend-checks.result == 'success' || needs.backend-checks.result == 'skipped') &&
needs.integration-test-build.result == 'success'
permissions:
contents: read
checks: write
packages: read
uses: ./.github/workflows/reusable-java-integration-lanes.yml
with:
profile_label: mysql-elasticsearch
maven_profile: mysql-elasticsearch
artifact_name: java-it-build-${{ github.run_id }}
lanes_json: '["parallel","global-state","multi-node","retry-queue","rdf"]'
store_database_version: ${{ inputs.store-database-version || 'shipped' }}
it-postgres-opensearch:
needs: [plan, backend-checks, integration-test-build]
if: >-
!cancelled() &&
needs.plan.result == 'success' &&
needs.plan.outputs.java-it == 'true' &&
(needs.backend-checks.result == 'success' || needs.backend-checks.result == 'skipped') &&
needs.integration-test-build.result == 'success'
permissions:
contents: read
checks: write
packages: read
uses: ./.github/workflows/reusable-java-integration-lanes.yml
with:
profile_label: postgres-opensearch
maven_profile: postgres-opensearch
artifact_name: java-it-build-${{ github.run_id }}
lanes_json: '["parallel","global-state","multi-node","retry-queue","rdf"]'
it-postgres-elasticsearch-redis:
needs: [plan, backend-checks, integration-test-build]
if: >-
!cancelled() &&
needs.plan.result == 'success' &&
needs.plan.outputs.java-it-redis == 'true' &&
(needs.backend-checks.result == 'success' || needs.backend-checks.result == 'skipped') &&
needs.integration-test-build.result == 'success'
permissions:
contents: read
checks: write
packages: read
uses: ./.github/workflows/reusable-java-integration-lanes.yml
with:
profile_label: postgres-elasticsearch-redis
maven_profile: cache-tests
artifact_name: java-it-build-${{ github.run_id }}
lanes_json: '["parallel","global-state","multi-node","retry-queue"]'
# JSON/YAML syntax, the CI rules and the quickstart compose file, each a step
# that runs only when the planner selects it, and each failing on its own. No
# status gate needs it: it is not a component's check, and the ruleset does not
# require it.
validate-config:
needs: plan
if: ${{ needs.plan.outputs.json-yaml == 'true' || needs.plan.outputs.ci-rules == 'true' || needs.plan.outputs.quickstart-compose == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ needs.plan.outputs.ref }}
persist-credentials: false
- uses: ./.github/actions/setup-python
if: ${{ needs.plan.outputs.json-yaml == 'true' || needs.plan.outputs.ci-rules == 'true' }}
with:
python-version: '3.12'
- uses: ./.github/actions/validate-json-yaml
if: ${{ needs.plan.outputs.json-yaml == 'true' }}
- uses: ./.github/actions/validate-ci-rules
if: ${{ !cancelled() && needs.plan.outputs.ci-rules == 'true' }}
# Last: it frees disk space by deleting runner tools and Docker images.
- name: Validate OpenMetadata Docker Compose
if: ${{ !cancelled() && needs.plan.outputs.quickstart-compose == 'true' }}
uses: ./.github/actions/validate-omd-docker-compose
with:
compose_file: ./docker/docker-compose-quickstart/docker-compose.yml
health_check_timeout: 300
data-access-request-e2e:
needs: plan
runs-on: ubuntu-latest
if: >-
needs.plan.outputs.dar == 'true' ||
(github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' &&
(inputs.workload == 'all' || inputs.workload == 'data-access-request'))
steps:
# Dispatched by file name straight to the REST endpoint, not through
# benc-uk/workflow-dispatch: that action finds the workflow by paging through the list of
# every Collate workflow, GitHub serves those pages in two different orders at random, and
# the lookup missed the workflow with "Unable to find workflow" on about one run in four.
- name: Trigger Collate Playwright run & wait
# Must stay above WAIT_SECONDS below. The step timeout kills the script outright, so when
# it is the smaller of the two the wait can never run out on its own and the step
# reports a bare "has timed out" with no downstream conclusion.
timeout-minutes: 100
env:
GH_TOKEN: ${{ secrets.COLLATE_PAT }}
COLLATE_REPO: open-metadata/openmetadata-collate
SHA: ${{ needs.plan.outputs.ref }}
EVENT: ${{ github.event_name }}
# The Collate job caps itself at timeout-minutes: 90, so waiting past that point is
# what guarantees we report its real conclusion instead of giving up first. Successful
# runs are 48-60 min today, already at the edge of the previous 61-min budget.
WAIT_SECONDS: 5700
run: |
run_id=$(gh api -X POST "repos/$COLLATE_REPO/actions/workflows/data-access-request-e2e.yml/dispatches" \
-f ref=main -f "inputs[sha]=$SHA" -f "inputs[event]=$EVENT" \
-F return_run_details=true --jq .workflow_run_id)
if [ -z "$run_id" ]; then
echo "::error::The dispatch returned no run id; find the run at https://github.com/$COLLATE_REPO/actions/workflows/data-access-request-e2e.yml"
exit 1
fi
run_url="https://github.com/$COLLATE_REPO/actions/runs/$run_id"
echo "Collate run: $run_url"
status=0
timeout "$WAIT_SECONDS" gh run watch "$run_id" --repo "$COLLATE_REPO" \
--interval 60 --compact --exit-status || status=$?
if [ "$status" -eq 124 ]; then
echo "::error::Collate run still in progress after ${WAIT_SECONDS}s: $run_url"
elif [ "$status" -ne 0 ]; then
echo "::error::Collate run did not succeed: $run_url"
fi
exit "$status"
backend-checks-status:
name: backend-checks-status
needs:
- plan
- backend-checks
- k8s_operator-unit-tests
- docker-image-smoke-test
- integration-test-build
- it-mysql-elasticsearch
- it-postgres-opensearch
- it-postgres-elasticsearch-redis
runs-on: ubuntu-slim
timeout-minutes: 5
if: ${{ always() && (github.event_name == 'merge_group' || inputs.workload == 'all' || inputs.workload == 'java') }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false
sparse-checkout: .github/actions/ci-status-gate
- uses: ./.github/actions/ci-status-gate
with:
needs: ${{ toJSON(needs) }}
expected: |
{
"plan": "success",
"backend-checks": "${{ needs.plan.outputs.checkstyle == 'true' && 'success' || 'skipped' }}",
"k8s_operator-unit-tests": "${{ needs.plan.outputs.java-operator == 'true' && 'success' || 'skipped' }}",
"docker-image-smoke-test": "${{ needs.plan.outputs.docker-smoke == 'true' && 'success' || 'skipped' }}",
"integration-test-build": "${{ needs.plan.outputs.java-it == 'true' && 'success' || 'skipped' }}",
"it-mysql-elasticsearch": "${{ needs.plan.outputs.java-it == 'true' && 'success' || 'skipped' }}",
"it-postgres-opensearch": "${{ needs.plan.outputs.java-it == 'true' && 'success' || 'skipped' }}",
"it-postgres-elasticsearch-redis": "${{ needs.plan.outputs.java-it-redis == 'true' && 'success' || 'skipped' }}"
}