Repository navigation
434 lines (400 loc) · 21.6 KB
/
Copy pathjava-playwright-nightly.yml
File metadata and controls
434 lines (400 loc) · 21.6 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
# Copyright 2026 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.
# Full run of the UI integration suite (*UIIT.java) — lives inside
# openmetadata-integration-tests under the `ui-it` Maven profile — and of the destructive search
# ITs (`search-it` profile), in embedded mode on both engines. Tracks EPIC #3731 / tickets #3767,
# #3792.
#
# Not run on PRs or in the merge queue. The scheduled runs live in openmetadata-nightly:
# k8s-java-it.yml runs these suites against an ephemeral cluster, plus the embedded jobs this
# workflow used to run on PRs (both engines, including the @Tag("search-direct") UIITs). Dispatch it
# here to test a branch on demand (pick the branch as the ref).
#
# Topology:
# - ui-it-nightly (x4): matrix over [opensearch, elasticsearch] x [shard 0, 1]. Each leg
# builds the openmetadata-dist tarball and bakes openmetadata-server:jpw-snapshot itself
# (BuildKit + shared GHA layer cache), then runs `mvn verify -P ui-it` with OM_TEST_IMAGE
# pointing at that tag so ContainerizedServer skips its own build. There is deliberately no
# upstream build-image job: it serialised ~17 min in front of every leg to save an image
# round-trip through a 461 MB artifact.
# - search-it-nightly (x3): server-global destructive search ITs (tests/search/*IT.java) via
# `mvn verify -P search-it`, sharded across runners. They run on the embedded bootstrap
# (testcontainers), not the baked image, so they need no image build at all.
#
# Both suites are serial *within* a runner — they mutate cluster-global search state — so the
# shard matrix is the only parallelism available. Each job deals itself a slice with
# `find | sort | awk 'NR % total == index'` and passes it as -Dit.test. Shard counts live in
# `env` and MUST match the matrix list lengths.
name: JavaUIIT Integration Tests
on:
workflow_dispatch:
inputs:
includeSsoBootstrap:
description: 'Also run @Tag("sso-bootstrap") UIITs (slower; second OM lifecycle)'
required: false
type: boolean
default: false
simpleReindexTables:
description: 'SimpleReindexTriggerUIIT table cohort size'
required: false
type: string
default: '5000'
simpleReindexTopics:
description: 'SimpleReindexTriggerUIIT topic cohort size'
required: false
type: string
default: '1500'
simpleReindexDashboards:
description: 'SimpleReindexTriggerUIIT dashboard cohort size'
required: false
type: string
default: '1500'
simpleReindexPipelines:
description: 'SimpleReindexTriggerUIIT pipeline cohort size'
required: false
type: string
default: '2000'
searchAvailableTables:
description: 'SearchAvailableDuringReindexUIIT table cohort size'
required: false
type: string
default: '5000'
reindexTimeoutMin:
description: 'Per-run reindex completion/acceptance timeout (minutes) for ui-it & search-it'
required: false
type: string
default: '60'
permissions:
contents: read
checks: write
concurrency:
# One run per ref; a new dispatch cancels the prior in-flight run.
group: java-playwright-nightly-${{ github.ref }}
cancel-in-progress: true
env:
SERVER_IMAGE_TAG: openmetadata-server:jpw-snapshot
# Must equal the length of the corresponding job's `shard:` matrix list — the round-robin
# deal below uses `NR % <count>`, so a mismatch silently drops classes. Kept here rather than
# derived because a matrix list cannot reference `env`.
UI_IT_SHARDS: 2
SEARCH_IT_SHARDS: 3
jobs:
ui-it-nightly:
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
searchEngine: [opensearch, elasticsearch]
shard: [0, 1]
steps:
- name: Free Disk Space (Ubuntu)
# android alone reclaims ~9 GB in seconds; the rest of this action's targets cost
# minutes of apt/rm for space this job never needs (measured 308s in the old
# build-image job, 72-99s here). Re-enable a target only with a "no space left"
# failure to point at.
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: false
haskell: false
large-packages: false
docker-images: false
swap-storage: false
- name: Checkout
uses: actions/checkout@v7
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: 'temurin'
- name: Cache Maven dependencies
uses: actions/cache@v6
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Install Ubuntu dependencies
# Java-only job: the unixodbc/librdkafka/sasl/ffi set exists for the Python ingestion
# build and nothing here links against it. ANTLR is the real dependency — openmetadata-spec
# generates parsers with it.
run: sudo make install_antlr_cli
- name: Add /etc/hosts entry for mock OIDC server
# The SSO test infrastructure (MockOidcServer) needs `om-mock-idp` to resolve to
# loopback on the host so the same URL works inside the Docker network and from
# the host-side Playwright browser, keeping the issued tokens' `iss` claim
# consistent across actors.
run: echo "127.0.0.1 om-mock-idp" | sudo tee -a /etc/hosts
- name: Restore openmetadata-ui dist cache
# openmetadata-dist transitively builds UI; integration-tests does not.
uses: ./.github/actions/cache-ui-dist
- name: Build integration-tests and dist
# ContainerizedServer.buildLocalImageContainer needs
# openmetadata-dist/target/openmetadata-*.tar.gz to bake the local image, and dist is
# NOT a transitive dep of integration-tests — both have to be asked for by name.
#
# One reactor pass, not two: as separate invocations Maven walked the shared upstream
# modules (spec, common, sdk, service) twice, which measured 146s + 321s. `-T 1C`
# parallelises independent branches of that graph across the runner's cores.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -T 1C -DskipTests install -pl :openmetadata-integration-tests,:openmetadata-dist -am
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build openmetadata-server image (with GHA layer cache)
# Built per matrix leg rather than once in a upstream job. A separate build-image job
# serialised ~17 min in front of every test job (build, save 461 MB, upload, download,
# load) for an image each leg then used alone. Building it here overlaps that cost with
# the leg's own setup and drops the artifact round-trip entirely; the shared GHA layer
# scope means the legs are not paying for it from scratch.
uses: docker/build-push-action@v7
with:
context: .
file: docker/development/Dockerfile
tags: ${{ env.SERVER_IMAGE_TAG }}
load: true
# Shared scope across matrix entries so the cache primed by this build
# is reused by everything that runs this workflow on the same SHA (or
# later runs whose Dockerfile + dist tarball haven't changed).
cache-from: type=gha,scope=jpw-server-image
# Only workflow_dispatch writes. Measured 2026-09-10: the exporting leg spent 272s on
# this step against 41s for the three legs that only read, and at 20.1m vs 16.7m that
# +231s was the whole reason the slowest job missed the 20-minute budget. A PR run has
# nothing to gain from its own write either — all four legs start together, so the
# export only ever helps some later run.
#
# Writing rarely is safe here because the layer worth caching is stable: the Dockerfile
# is 3-stage and the expensive stage is `jre-builder` (jlink), which depends on the JDK
# base image, not on the PR. Only the cheap `dist` untar layer changes per PR. If the
# Dockerfile's builder stage or its base image changes, the next PR legs cold-build
# (~230s each, degraded but not broken) until someone runs this workflow via
# workflow_dispatch once to repopulate the scope.
#
# merge_group must never write regardless: the queue's gh-readonly-queue/* ref dies the
# moment its entry merges, but every buildkit-blob-* entry saved there (mode=max exports
# each layer — dozens per build, 0-380 MB each) stays charged against the repo's 10 GB
# LRU budget until evicted. Measured 2026-09-09: one queue ref alone held ~40 blobs and
# the repo sat at 18 GB, which evicted every main-scoped Playwright cache; downstream,
# 231 of 235 merge_group Playwright runs in 24h missed the fixture cache and rebuilt it
# from scratch (~17 min each on the critical path).
cache-to: ${{ github.event_name == 'workflow_dispatch' && 'type=gha,scope=jpw-server-image,mode=max' || '' }}
- name: Install Playwright browsers
run: |
mvn -pl :openmetadata-integration-tests dependency:build-classpath -Dmdep.outputFile=/tmp/cp.txt -q
java -cp "$(cat /tmp/cp.txt)" com.microsoft.playwright.CLI install --with-deps chromium
- name: Free build artifacts
run: |
rm -rf openmetadata-service/target/lib openmetadata-service/target/classes
rm -rf openmetadata-spec/target openmetadata-sdk/target common/target
rm -rf openmetadata-shaded-deps/*/target
df -h /
- name: Run UI integration tests (${{ matrix.searchEngine }} shard ${{ matrix.shard }})
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# OM_TEST_IMAGE makes ContainerizedServer skip its in-test `docker build`
# and reuse the image built above. Cuts ~10-90s per launch.
OM_TEST_IMAGE: ${{ env.SERVER_IMAGE_TAG }}
# UiSessionExtension reads PW_VIDEO and records every test's BrowserContext
# to target/playwright-videos when true. Kept off locally; on in CI for triage.
PW_VIDEO: 'true'
run: |
# Embedded nightly recreates a fresh stack each run, so data never persists — these
# small-footprint suites always create on the fly (jpw.data.mode=ingest). Static/ensure
# reuse only pays off against a cluster you keep around between runs, which no workflow
# here does; set OM_URL + OM_ADMIN_TOKEN to point the suites at one by hand.
# Cohort sizes are set ONLY on workflow_dispatch. `github.event.inputs.*` is empty on
# pull_request/merge_group, so the old unconditional `|| '5000'` fallback meant every PR
# ingested the full nightly stress cohort (10k entities) instead of the 200/100/100/100
# baked into each test — 20x the data, ~5 min per test, on a run that only needs the
# regression signal. Leaving the props unset is what makes the in-test defaults apply.
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
STRESS_PROPS="-Djpw.simpleReindex.tables=${{ github.event.inputs.simpleReindexTables || '5000' }} \
-Djpw.simpleReindex.topics=${{ github.event.inputs.simpleReindexTopics || '1500' }} \
-Djpw.simpleReindex.dashboards=${{ github.event.inputs.simpleReindexDashboards || '1500' }} \
-Djpw.simpleReindex.pipelines=${{ github.event.inputs.simpleReindexPipelines || '2000' }} \
-Djpw.searchAvailable.tables=${{ github.event.inputs.searchAvailableTables || '5000' }}"
else
STRESS_PROPS=""
fi
STRESS_PROPS="$STRESS_PROPS -Djpw.data.mode=ingest \
-Djpw.reindex.timeoutMin=${{ github.event.inputs.reindexTimeoutMin || '60' }}"
# Opt-in for SSO bootstrap UIITs (second OM lifecycle); default off.
if [ "${{ github.event.inputs.includeSsoBootstrap }}" = "true" ]; then
SSO_PROPS="-Dui.it.excludedGroups="
else
SSO_PROPS=""
fi
# These suites are serial within a runner — they mutate cluster-global search state —
# so splitting classes across runners is the only parallelism available.
#
# Sorted round-robin over the discovered files. Measured alternatives: hash(name) % N
# put 8 of 9 classes on one shard (no speedup at all), and N=3 round-robin was worse
# than N=2 because the slow Search*/Long* classes sort adjacent. Balance here is luck —
# with 11 classes spanning 0s to 206s nothing name-derived can balance reliably, and a
# checked-in duration table would need hand-maintenance to stay honest. It is good
# enough because per-shard fixed cost (image build + OM stack start) dominates the
# tests; cut that before adding shards. `find | sort` is stable, so a new test file
# joins a shard on its own.
SHARD_CLASSES=$(find openmetadata-integration-tests/src/test/java -name '*UIIT.java' \
| sort | awk -v t=${{ env.UI_IT_SHARDS }} -v i=${{ matrix.shard }} 'NR % t == i' \
| sed 's|.*/||;s|\.java$||' | paste -sd, -)
if [ -z "$SHARD_CLASSES" ]; then
echo "Shard ${{ matrix.shard }} matched no UIIT classes — check UI_IT_SHARDS." >&2
exit 1
fi
echo "shard ${{ matrix.shard }}: $SHARD_CLASSES"
SHARD_PROPS="-Dit.test=$SHARD_CLASSES -Dfailsafe.failIfNoSpecifiedTests=false"
if [ "${{ matrix.searchEngine }}" = "elasticsearch" ]; then
mvn verify -P ui-it -pl :openmetadata-integration-tests $STRESS_PROPS $SSO_PROPS $SHARD_PROPS \
-DsearchType=elasticsearch \
-DsearchImage=docker.elastic.co/elasticsearch/elasticsearch:9.3.0
else
mvn verify -P ui-it -pl :openmetadata-integration-tests $STRESS_PROPS $SSO_PROPS $SHARD_PROPS
fi
- name: Upload Playwright traces
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: playwright-traces-${{ matrix.searchEngine }}-s${{ matrix.shard }}-${{ github.run_id }}
path: openmetadata-integration-tests/target/playwright-traces
if-no-files-found: ignore
retention-days: 14
- name: Upload Playwright videos
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: playwright-videos-${{ matrix.searchEngine }}-s${{ matrix.shard }}-${{ github.run_id }}
path: openmetadata-integration-tests/target/playwright-videos
if-no-files-found: ignore
retention-days: 14
- name: Upload Failsafe Reports
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: failsafe-reports-${{ matrix.searchEngine }}-s${{ matrix.shard }}-${{ github.run_id }}
path: openmetadata-integration-tests/target/failsafe-reports
if-no-files-found: ignore
retention-days: 14
- name: Publish Test Report
id: report
if: ${{ always() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
uses: scacap/action-surefire-report@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# mvn verify already fails the job on test failures. This step just
# publishes the check run with per-test details; it shouldn't itself
# gate the job conclusion (otherwise a flake here breaks Slack).
fail_on_test_failures: false
report_paths: 'openmetadata-integration-tests/target/failsafe-reports/TEST-*.xml'
# Failures only: a green nightly is the expected case and notifying on it trains
# the channel to ignore the alert.
- name: Slack notification
if: ${{ failure() && github.event_name != 'pull_request' && env.SLACK_JAVA_PLAYWRIGHT_URL != '' }}
uses: slackapi/slack-github-action@v4.0.0
with:
webhook: ${{ env.SLACK_JAVA_PLAYWRIGHT_URL }}
webhook-type: incoming-webhook
payload: |
text: ":fire: Java Playwright Nightly (${{ matrix.searchEngine }}): ${{ job.status }}\nRef: ${{ github.ref_name }}\nLogs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
env:
SLACK_JAVA_PLAYWRIGHT_URL: ${{ secrets.SLACK_JAVA_PLAYWRIGHT_URL }}
search-it-nightly:
# Server-global destructive search ITs (tests/search/*IT.java): full reindex with
# recreateIndex, alias swaps, and ES container pause. They mutate cluster-wide state, so
# the default PR profiles exclude them; here the `search-it` Maven profile runs them
# serially on their own embedded-bootstrap server (testcontainers). That bootstrap needs no
# server image, which is why this job skips the dist + docker build the ui-it legs pay for.
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
shard: [0, 1, 2]
steps:
- name: Free Disk Space (Ubuntu)
# See the ui-it job: android is the only target worth its runtime here.
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: false
haskell: false
large-packages: false
docker-images: false
swap-storage: false
- name: Checkout
uses: actions/checkout@v7
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: '21'
distribution: 'temurin'
- name: Cache Maven dependencies
uses: actions/cache@v6
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Install Ubuntu dependencies
# Java-only job — see the ui-it job for why the Python ingestion packages are gone.
run: sudo make install_antlr_cli
- name: Build dependencies for integration-tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -T 1C -DskipTests install -pl :openmetadata-integration-tests -am
- name: Run isolated search ITs (postgres + opensearch)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Embedded bootstrap = fresh stack each run; these search ITs create their cohorts on the
# fly (jpw.data.mode=ingest). Static/ensure reuse is for the external cluster only.
# Sorted round-robin across runners (see the ui-it job for why not a hash). The
# profile's own excludes still apply on top of -Dit.test, so the scale/seed/purge
# classes stay out.
run: |
SHARD_CLASSES=$(find openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/search -maxdepth 1 -name '*IT.java' \
| sort | awk -v t=${{ env.SEARCH_IT_SHARDS }} -v i=${{ matrix.shard }} 'NR % t == i' \
| sed 's|.*/||;s|\.java$||' | grep -vE '^(StaticDatasetSeedIT|ClusterPurgeIT)$' | paste -sd, -)
if [ -z "$SHARD_CLASSES" ]; then
echo "Shard ${{ matrix.shard }} matched no search IT classes — check SEARCH_IT_SHARDS." >&2
exit 1
fi
echo "shard ${{ matrix.shard }}: $SHARD_CLASSES"
mvn verify -P search-it -pl :openmetadata-integration-tests -DdatabaseType=postgres -DsearchType=opensearch -Djpw.data.mode=ingest -Djpw.reindex.timeoutMin=${{ github.event.inputs.reindexTimeoutMin || '60' }} -Dit.test="$SHARD_CLASSES" -Dfailsafe.failIfNoSpecifiedTests=false
- name: Upload Failsafe Reports
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: failsafe-reports-search-it-s${{ matrix.shard }}-${{ github.run_id }}
path: openmetadata-integration-tests/target/failsafe-reports
if-no-files-found: ignore
retention-days: 14
- name: Publish Test Report
if: ${{ always() && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) }}
uses: scacap/action-surefire-report@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
fail_on_test_failures: false
report_paths: 'openmetadata-integration-tests/target/failsafe-reports/TEST-*.xml'
# Failures only: a green nightly is the expected case and notifying on it trains
# the channel to ignore the alert.
- name: Slack notification
if: ${{ failure() && github.event_name != 'pull_request' && env.SLACK_JAVA_PLAYWRIGHT_URL != '' }}
uses: slackapi/slack-github-action@v4.0.0
with:
webhook: ${{ env.SLACK_JAVA_PLAYWRIGHT_URL }}
webhook-type: incoming-webhook
payload: |
text: ":fire: Java Search ITs Nightly (shard ${{ matrix.shard }}): ${{ job.status }}\nRef: ${{ github.ref_name }}\nLogs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
env:
SLACK_JAVA_PLAYWRIGHT_URL: ${{ secrets.SLACK_JAVA_PLAYWRIGHT_URL }}