Repository navigation
Fixes 34944: faster Playwright pipeline (plan alongside build, narrower fixture key, node_modules cache) - #34946
ayush-shah wants to merge 5 commits into
Conversation
plan-playwright waited for `build` although it consumes nothing the build produces: it reads the checkout, the playwright-selection artifact uploaded by detect-changes and detect-changes' outputs. The distribution artifact is downloaded only by prepare-playwright-fixture and the shards, and both still declare `build` in their own `needs`. Medians over Sep 25 - Oct 8 put build at 0.6 -> 6.7 min and plan at 6.8 -> 9.3 min, with restore-playwright-fixture (needs plan) at 9.4 -> 10.0. Running plan and the restore alongside the build takes both off the critical path, so on a fixture-cache hit the shards can start ~3 min earlier; on a miss prepare-playwright-fixture still starts as soon as the build finishes. A test pins the planner to detect-changes and checks that every consumer of the distribution still waits for the build.
The ingestion-image key hashed all of openmetadata-spec/ and ingestion/, so Java model edits, search mappings, type stubs, lint baselines and the operator Dockerfiles each discarded a ~1.3 GB image whose bytes they never touch. The key now follows ingestion/Dockerfile.ci: of openmetadata-spec it reads only the JSON schemas (datamodel_generation.py) and ANTLR grammars, and it drops COPY'd-but-unused paths (tests, docs, stubs, operators/, the non-CI Dockerfile, Makefile/nox/lint configs, airflow-apis tests and development/). Root pom.xml and the server Dockerfile were never build inputs. ingestion/scripts/ stays because the Dockerfile runs a script from it, and markdown under ingestion/src stays because package data ships it. Replaying 1601 first-parent main commits (Aug 8 - Oct 8 2026), the share that invalidates the image falls from 23.8% to 20.3%; what remains changes ingestion/src, which the image installs. The new selection is a strict subset of the old one, and populate-playwright-caches.yml computes its key through the same reusable cache-keys job, so writer and readers stay identical. Tests pin both directions: every real build input still changes the key, every excluded path does not, and every COPY source in Dockerfile.ci must be fingerprinted.
Every playwright-ci shard restored the ~700 MB yarn package cache and ran yarn install: 25 s + 30 s median across the 52 shards of two merge-queue runs on Oct 8 2026, the largest per-shard setup cost after the environment itself. With `--ignore-scripts`, node_modules is a pure function of yarn.lock, the Node ABI and the runner platform (the one `link:` dependency is a symlink into the checkout), so it can be cached as a tree. populate-playwright-caches.yml, already the single main-scoped writer, now saves node_modules right after its yarn warm succeeds, keyed on OS, arch, the resolved Node version and the yarn.lock hash. Shards restore it read-only; the yarn package cache restore runs only on a miss. The install step still runs on a hit and executes `yarn check --integrity --ignore-scripts`, which compares .yarn-integrity with yarn.lock, the flags and the Node ABI offline; on any mismatch it falls through to the normal retrying install, so a stale or foreign tree can never be used. The other per-shard steps were checked and left alone: the browser cache and the apt-deps cache already hit (1 s + 4 s + 5 s medians), and the 8 s bundle-smoke is not a duplicate. On a fixture-cache hit the fixture job skips its own bundle-smoke, so the shard's run is the only check that this run's freshly built bundle boots against the restored environment.
playwright-visual takes ~25 min per run, ~21 of it in the full run_local_docker MySQL build-and-seed, for ~2 min of screenshot tests. The E2E shards boot the same server in ~1.5 min (median) from a distribution plus the golden PostgreSQL fixture that populate-playwright-caches.yml keeps warm on main. This adds that path behind a workflow_dispatch input, `setup_mode`, whose default `full-docker` keeps every pull_request and merge_group run on the existing MySQL bootstrap. `postgres-fixture` restores the golden fixture (restore-only, the same key the reusable pipeline reads), builds the distribution, and starts it in fast mode; a cache miss or failed validation falls back to the full-docker setup. The suite then runs with PW_PRESEEDED_STATE and the fixture's runtime directory mounted into the Playwright container, since the seeded auth/entity state is symlinked from there. It is opt-in because the baselines were captured against the MySQL seed and could not be re-validated here: the fixture's data differs, and any page that renders seeded data may need its snapshot re-captured. Once a dispatch run passes, flipping the default (or the PR/queue condition) saves roughly 13 min per run: ~21 min of setup becomes the ~6 min distribution build plus ~1.5 min fast start. The visual-regression project's dependencies now use entityDependencies, which is ['setup', 'entity-data-setup'] unless PW_PRESEEDED_STATE is true, so the default path runs exactly the same projects as before.
playwright-knowledge-graph-postgresql-e2e.yml triggered on both pull_request and pull_request_target, each including `labeled`, so every PR event started two workflow runs: one did the work and the other only ran its gate to decide it should skip. Labelling a PR started two more. Following #34740, which made the same move for playwright-postgresql-e2e: drop pull_request_target and the `labeled` type. Same-repo PRs still run the suite under pull_request. Fork PRs cannot read the connector secrets there, so the gate skips them and the merge queue (which always runs the suite) is where fork code is tested, matching the Postgres E2E workflow. The fork label-reconciliation steps, the head-SHA checkout override and the pull_request_target cache-poisoning guards go with the trigger. With no sibling run, an early green skip can no longer satisfy branch protection before the real run finishes, so the summary always publishes the required `Playwright RDF (Knowledge Graph + Ontology)` name; a skipped gate (draft or fork PR) reports it green and a gate failure still fails it. cancel-in-progress is now unconditional, since the label special cases no longer exist. A test pins the trigger set, the summary name and the gate decision.
f5036fd to
8155096
Compare
Code Review ✅ Approved🟡 Medium risk · Narrowing ingestion cache fingerprints and moving fork checks to merge queues could reuse stale images or delay knowledge-graph coverage. Optimizes the Playwright CI pipeline by planning shards in parallel with the build, narrowing the ingestion-image fingerprint to only Dockerfile inputs, caching VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
Describe your changes:
Fixes #34944
Shortens the Playwright critical path and removes repeated setup without changing which tests run. Measured: ~26 min passes before any
playwright-cishard starts (build 0.6→6.7, plan 6.8→9.3, fixture restore 9.4→10.0, prepare 10.0→25.9, medians), and the fixture cache hits only ~35% of the time.Type of change:
High-level design:
One commit per change:
plan-playwrightnow needs onlydetect-changes. It uses only the checkout, theplaywright-selectionartifact and detect-changes outputs; prepare and the shards still needbuild. This saves ~3 min of critical path on a fixture-cache hit.playwright_cache_fingerprint.py). The key now follows whatingestion/Dockerfile.ciactually copies (spec JSON schemas, ANTLR grammars,ingestion/sources). The new file set is a strict subset of the old one. A test fails if any DockerfileCOPYsource is not fingerprinted. Replaying 1,601 main commits, invalidation drops from 23.8% to 20.3%; the rest are realingestion/srcchanges. Populate and readers compute the key in the same reusable job.populate-playwright-caches.yml(main only, the existing single writer) savesnode_modules, keyed on OS/arch/Node/yarn.lock. Shards restore it read-only and check it withyarn check --integrity; a miss or mismatch falls back to the normal install. Expected ~30–40 s per shard.playwright-visual.ymlgets aworkflow_dispatchinputsetup_mode(defaultfull-docker, so PR and queue runs are unchanged).postgres-fixturerestores the golden fixture and starts the fast environment (~21 → ~7.5 min of setup). It is opt-in because the baselines were captured on the MySQL seed and may need re-capturing; one dispatch run will tell.playwright-knowledge-graph-postgresql-e2e.ymldropspull_request_target+labeledand the fork-label plumbing, following ci: Python integration tests and Playwright E2E only in the merge queue #34740. Fork PRs are covered by the merge queue, as with the Postgres E2E workflow.Not done, follow-ups:
Tests:
Use cases covered
ingestion/tests/**) no longer invalidates the fixture.yarn install; a corrupted or mismatched cache reinstalls.setup_mode=postgres-fixture.Unit tests
test_playwright_cache_assets.py(fingerprint classification, Dockerfile COPY coverage, plan dependencies) andtest_playwright_merge_group_validation.py..github/scriptssuite: only pre-existing failures remain;test_retry_policy_is_one_everywhere_during_the_flake_weekfails identically onorigin/main.actionlint: no new findings (the 9 existingjobs.X.resultwarnings in the reusable workflow are unchanged).shellcheckclean on changed scripts.Backend integration tests
Ingestion integration tests
Playwright (UI) tests
playwright.config.tshas a one-line change: visual-regression usesentityDependencies, which is identical unless preseeded.Manual testing performed
Static validation only. The visual fixture path needs one
workflow_dispatchrun withsetup_mode=postgres-fixturebefore flipping the default.UI screen recording / screenshots:
Not applicable.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.