Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion .github/actions/setup-openmetadata-test-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ inputs:
required: false
default: "true"
fast-mode:
description: Restore a pre-seeded PostgreSQL/OpenSearch fixture and start the server on the host
description: Restore a pre-seeded Playwright fixture (PostgreSQL/OpenSearch or MySQL/Elasticsearch) and start the server on the host
required: false
default: "false"
fixture-path:
Expand Down Expand Up @@ -223,6 +223,19 @@ runs:
retry_on: error
command: ${{ inputs.startup-script }} ${{ inputs.args }}

# ADR:2026-10-28-playwright-fast-mode-pulls-images-outside-the-startup-budget
- name: Pull fast Playwright environment images
if: ${{ inputs.install-server == 'true' && inputs.fast-mode == 'true' }}
run: |
# Assigned rather than read through process substitution, whose exit
# status is lost: an unreadable fixture must fail here, not skip the pull.
manifest=$(tar --zstd --occurrence=1 -xOf "${{ inputs.fixture-path }}" ./fixture-manifest.json)
database_image=$(jq -er '.databaseImage' <<<"$manifest")
search_image=$(jq -er '.searchImage' <<<"$manifest")
timeout --signal=TERM --kill-after=30s 15m \
./.github/scripts/pull_playwright_fixture_images.sh "$database_image" "$search_image"
shell: bash

- name: Restore fast Playwright environment
if: ${{ inputs.install-server == 'true' && inputs.fast-mode == 'true' }}
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/playwright/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ Specs that repeat the same scenarios for every entity type (Entity, Lineage, Cus

## Golden fixture

The preparation job runs migrations, sample ingestion, reindexing, authentication setup, and shared entity prerequisites once. The fixture manifest records the source commit, schema hash, seed hash/version, Playwright-state hash, PostgreSQL and OpenSearch image digests, search cluster alias, and the ingestion image ID. Each shard validates the manifest, extracts database/search/auth state under `/dev/shm`, verifies the seeded search indexes, and starts the built OpenMetadata distribution directly on the host with the recorded alias. The pre-seeded response manifest keeps the randomly named shared entities stable across the fixture builder and shard processes.
The preparation job runs migrations, sample ingestion, reindexing, authentication setup, and shared entity prerequisites once. The fixture manifest records the source commit, schema hash, seed hash/version, Playwright-state hash, the database it was seeded on with its database and search image digests, search cluster alias, and the ingestion image ID. The `database` input picks the stack: `postgresql` pairs PostgreSQL with OpenSearch, `mysql` pairs MySQL with Elasticsearch, both described in `.github/scripts/playwright_fixture_profile.sh`. The fixture cache key carries the database, and the validator and shard launcher reject a fixture seeded on a different one. Each shard validates the manifest, extracts database/search/auth state under `/dev/shm`, verifies the seeded search indexes, and starts the built OpenMetadata distribution directly on the host with the recorded alias. The pre-seeded response manifest keeps the randomly named shared entities stable across the fixture builder and shard processes.

The Airflow ingestion image is restored or built once by its own `prepare-ingestion-image` job, alongside `build`. A fixture rebuild loads that image (`OM_INGESTION_IMAGE_PRELOADED=true` makes `run_local_docker` skip building it) and still seeds from scratch whenever any fixture input changes; the Airflow shards load the same image.

Standard shards do not build Docker images, run migrations, start Airflow, ingest sample data, reindex, repeat authentication, or recreate shared entity prerequisites. PostgreSQL durability is disabled for the disposable clone, OpenSearch uses a 2 GiB heap and zero replicas, and routine logs are bounded.
Standard shards do not build Docker images, run migrations, start Airflow, ingest sample data, reindex, repeat authentication, or recreate shared entity prerequisites. Database durability is disabled for the disposable clone, the search engine uses a 2 GiB heap and zero replicas, and routine logs are bounded.

## Measurements and gates

Expand Down
50 changes: 32 additions & 18 deletions .github/scripts/create_playwright_fixture.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,44 @@ fi

output_path=$(realpath -m "$1")
runner_temp=${RUNNER_TEMP:-/tmp}
stage_dir=$(mktemp -d "${runner_temp}/playwright-fixture.XXXXXX")
workspace_root=${GITHUB_WORKSPACE:-$(pwd)}
playwright_root="$workspace_root/openmetadata-ui/src/main/resources/ui/playwright"
auth_source="$playwright_root/.auth"
entity_state_source="$playwright_root/output/entity-response-data.json"
lineage_state_source="$playwright_root/output/lineage-data.json"
shared_infra_state_source="$playwright_root/output/shared-infra.json"
fingerprint_script="$workspace_root/.github/scripts/playwright_cache_fingerprint.py"
database=${PLAYWRIGHT_DATABASE:-postgresql}

# shellcheck source=playwright_fixture_profile.sh
source "$workspace_root/.github/scripts/playwright_fixture_profile.sh"
load_playwright_fixture_profile "$database"
stage_dir=$(mktemp -d "${runner_temp}/playwright-fixture.XXXXXX")

cleanup() {
sudo rm -rf "$stage_dir"
}
trap cleanup EXIT

postgres_source=$(docker inspect openmetadata_postgresql --format '{{range .Mounts}}{{if eq .Destination "/var/lib/postgresql/data"}}{{.Source}}{{end}}{{end}}')
opensearch_source=$(docker inspect openmetadata_opensearch --format '{{range .Mounts}}{{if eq .Destination "/usr/share/opensearch/data"}}{{.Source}}{{end}}{{end}}')
opensearch_reference=$(docker inspect openmetadata_opensearch --format '{{.Config.Image}}')
mount_source() {
docker inspect "$1" --format "{{range .Mounts}}{{if eq .Destination \"$2\"}}{{.Source}}{{end}}{{end}}"
}

database_source=$(mount_source "$PW_DATABASE_CONTAINER" "$PW_DATABASE_DATA_PATH")
search_source=$(mount_source "$PW_SEARCH_CONTAINER" "$PW_SEARCH_DATA_PATH")
search_reference=$(docker inspect "$PW_SEARCH_CONTAINER" --format '{{.Config.Image}}')
# The seeded database container runs an image built from this Dockerfile; the
# fast environment restores the data directory onto its upstream base image.
database_reference=$(sed -n 's/^FROM[[:space:]]\{1,\}//p' "$workspace_root/$PW_DATABASE_DOCKERFILE" | head -1)
search_cluster_alias=$(
docker inspect openmetadata_server --format '{{range .Config.Env}}{{println .}}{{end}}' |
sed -n 's/^ELASTICSEARCH_CLUSTER_ALIAS=//p' |
head -1 |
sed -E 's/^[[:space:]]+//; s/[[:space:]]+$//; s/^"([^"]+)"$/\1/'
)

if [[ -z "$postgres_source" || -z "$opensearch_source" || -z "$search_cluster_alias" ]]; then
echo "Could not resolve PostgreSQL, OpenSearch, or search cluster fixture settings" >&2
if [[ -z "$database_source" || -z "$search_source" || -z "$database_reference" || -z "$search_cluster_alias" ]]; then
echo "Could not resolve the $database database, search, or search cluster fixture settings" >&2
exit 1
fi

Expand All @@ -51,7 +63,7 @@ for state_file in \
done

docker stop --time 30 openmetadata_ingestion openmetadata_server >/dev/null 2>&1 || true
docker stop --time 30 openmetadata_postgresql openmetadata_opensearch >/dev/null
docker stop --time 30 "$PW_DATABASE_CONTAINER" "$PW_SEARCH_CONTAINER" >/dev/null

resolve_digest() {
local reference=$1
Expand All @@ -73,18 +85,18 @@ resolve_digest() {
}

sudo mkdir -p \
"$stage_dir/postgres" \
"$stage_dir/opensearch" \
"$stage_dir/database" \
"$stage_dir/search" \
"$stage_dir/playwright-state/auth"
sudo cp -a "$postgres_source/." "$stage_dir/postgres/"
sudo cp -a "$opensearch_source/." "$stage_dir/opensearch/"
sudo cp -a "$database_source/." "$stage_dir/database/"
sudo cp -a "$search_source/." "$stage_dir/search/"
sudo cp -a "$auth_source/." "$stage_dir/playwright-state/auth/"
sudo cp -a "$entity_state_source" "$stage_dir/playwright-state/entity-response-data.json"
sudo cp -a "$lineage_state_source" "$stage_dir/playwright-state/lineage-data.json"
sudo cp -a "$shared_infra_state_source" "$stage_dir/playwright-state/shared-infra.json"

postgres_image=$(resolve_digest postgres:15)
opensearch_image=$(resolve_digest "$opensearch_reference")
database_image=$(resolve_digest "$database_reference")
search_image=$(resolve_digest "$search_reference")
fixture_compatibility_hash=$(python3 "$fingerprint_script" --kind fixture)
schema_hash=$(python3 "$fingerprint_script" --kind schema)
seed_hash=$(python3 "$fingerprint_script" --kind seed)
Expand All @@ -103,20 +115,22 @@ jq -n \
--arg sourceSha "$source_sha" \
--arg createdAt "$created_at" \
--arg compatibilityHash "$fixture_compatibility_hash" \
--arg postgresImage "$postgres_image" \
--arg opensearchImage "$opensearch_image" \
--arg database "$database" \
--arg databaseImage "$database_image" \
--arg searchImage "$search_image" \
--arg searchClusterAlias "$search_cluster_alias" \
--arg schemaHash "$schema_hash" \
--arg seedHash "$seed_hash" \
--arg seedVersion "$seed_version" \
--arg playwrightStateHash "$playwright_state_hash" \
'{
version: 2,
version: 3,
sourceSha: $sourceSha,
createdAt: $createdAt,
compatibilityHash: $compatibilityHash,
postgresImage: $postgresImage,
opensearchImage: $opensearchImage,
database: $database,
databaseImage: $databaseImage,
searchImage: $searchImage,
searchClusterAlias: $searchClusterAlias,
schemaHash: $schemaHash,
seedHash: $seedHash,
Expand Down
4 changes: 4 additions & 0 deletions .github/scripts/playwright_cache_fingerprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,13 @@
"ingestion/src/metadata/ingestion/source/database/extended_sample_data/",
"ingestion/examples/airflow/dags/airflow_sample_data.py",
"ingestion/examples/airflow/dags/airflow_extended_sample_data.py",
"docker/development/docker-compose.yml",
"docker/development/docker-compose-postgres.yml",
"docker/development/docker-compose-playwright-fast.yml",
"docker/development/docker-compose-playwright-fast-mysql.yml",
"docker/development/playwright-autopilot-mysql.sql",
"docker/development/Dockerfile",
"docker/mysql/",
"docker/postgresql/",
"docker/run_local_docker.sh",
"docker/run_local_docker_common.sh",
Expand All @@ -112,6 +115,7 @@
"openmetadata-ui/src/main/resources/ui/yarn.lock",
".github/actions/setup-openmetadata-test-environment/",
".github/scripts/create_playwright_fixture.sh",
".github/scripts/playwright_fixture_profile.sh",
".github/scripts/start_playwright_fast_environment.sh",
".github/scripts/start_playwright_autopilot_mysql.sh",
".github/scripts/rotate_playwright_auth_state.py",
Expand Down
75 changes: 75 additions & 0 deletions .github/scripts/playwright_fixture_profile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/usr/bin/env bash

# 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.

# Sourced by the fixture builder, validator and fast-environment launcher so the
# database a fixture was seeded on (the `database` input of
# playwright-e2e-reusable.yml) is restored onto the same engine and search
# backend. The PostgreSQL stack pairs with OpenSearch, the MySQL stack with
# Elasticsearch, mirroring their docker/development compose files.
# ADR:2026-10-28-playwright-golden-fixtures-are-scoped-to-their-seed-database
load_playwright_fixture_profile() {
case "$1" in
postgresql)
PW_COMPOSE_FILE=docker/development/docker-compose-postgres.yml
PW_FAST_COMPOSE_FILE=docker/development/docker-compose-playwright-fast.yml
PW_DATABASE_SERVICE=postgresql
PW_DATABASE_CONTAINER=openmetadata_postgresql
PW_DATABASE_DATA_PATH=/var/lib/postgresql/data
PW_DATABASE_DOCKERFILE=docker/postgresql/Dockerfile_postgres
PW_DATABASE_MARKER=./database/PG_VERSION
PW_DB_DRIVER_CLASS=org.postgresql.Driver
PW_DB_SCHEME=postgresql
PW_DB_PORT=5432
PW_AIRFLOW_DB_SCHEME=postgresql+psycopg2
PW_SEARCH_SERVICE=opensearch
Comment thread
gitar-bot[bot] marked this conversation as resolved.
Resolved
PW_SEARCH_CONTAINER=openmetadata_opensearch
PW_SEARCH_DATA_PATH=/usr/share/opensearch/data
PW_SEARCH_MARKER=./search/nodes/
PW_SEARCH_TYPE=opensearch
;;
mysql)
PW_COMPOSE_FILE=docker/development/docker-compose.yml
PW_FAST_COMPOSE_FILE=docker/development/docker-compose-playwright-fast-mysql.yml
PW_DATABASE_SERVICE=mysql
PW_DATABASE_CONTAINER=openmetadata_mysql
PW_DATABASE_DATA_PATH=/var/lib/mysql
PW_DATABASE_DOCKERFILE=docker/mysql/Dockerfile_mysql
PW_DATABASE_MARKER=./database/mysql.ibd
PW_DB_DRIVER_CLASS=com.mysql.cj.jdbc.Driver
PW_DB_SCHEME=mysql
PW_DB_PORT=3306
PW_AIRFLOW_DB_SCHEME=mysql+mysqldb
PW_SEARCH_SERVICE=elasticsearch
PW_SEARCH_CONTAINER=openmetadata_elasticsearch
PW_SEARCH_DATA_PATH=/usr/share/elasticsearch/data
# Elasticsearch 8+ dropped the nodes/<n>/ level that OpenSearch still uses.
PW_SEARCH_MARKER=./search/indices/
PW_SEARCH_TYPE=elasticsearch
;;
*)
echo "Unsupported Playwright fixture database: ${1:-<empty>}" >&2
return 1
;;
esac
}

# Loads the profile of the database a fixture manifest was seeded on, refusing
# a fixture from another engine when the workflow pins PLAYWRIGHT_DATABASE.
load_playwright_fixture_profile_from_manifest() {
PW_FIXTURE_DATABASE=$(jq -r '.database // empty' "$1")
if [[ -n "${PLAYWRIGHT_DATABASE:-}" && "$PW_FIXTURE_DATABASE" != "$PLAYWRIGHT_DATABASE" ]]; then
echo "The Playwright fixture was seeded on '${PW_FIXTURE_DATABASE:-unknown}', not '$PLAYWRIGHT_DATABASE'" >&2
return 1
fi
load_playwright_fixture_profile "$PW_FIXTURE_DATABASE"
}
63 changes: 63 additions & 0 deletions .github/scripts/pull_playwright_fixture_images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env bash

# 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.

set -euo pipefail

if [[ $# -lt 1 ]]; then
echo "Usage: $0 <image>..." >&2
exit 2
fi

# Pre-pull the compose images with retries so a transient Docker Hub blip does
# not fail the shard on the very first step. Docker Hub's auth endpoint is
# unreliable enough that a single request per image regularly times out (see
# run 30730142750 where chromium-14/19/20 all failed on
# `Get "https://auth.docker.io/token?..."` with no test having run). Separating
# the pull from `docker compose up` also gives a clearer error when pulls
# actually fail — no orphan containers, exit before the health-wait loop.
pull_image_with_retry() {
local image=$1
if docker image inspect "$image" >/dev/null 2>&1; then
return 0 # already cached from a previous invocation on the same runner
fi
local delay=10
local attempt
for attempt in 1 2 3; do
if docker pull --quiet "$image"; then
return 0
fi
if [[ $attempt -eq 3 ]]; then
echo "docker pull failed for $image after 3 attempts" >&2
return 1
fi
echo "docker pull $image failed on attempt $attempt; retrying in ${delay}s" >&2
sleep "$delay"
delay=$(( delay * 2 ))
done
}

# Pulled together rather than one after the other: import-export-02 on run
# 34826046448 spent 22s on postgres and 3m44s on opensearch back to back.
# `wait` is checked per job so a failed pull still stops the script with its
# own message instead of being swallowed.
pull_pids=()
for image in "$@"; do
pull_image_with_retry "$image" &
pull_pids+=("$!")
done

pull_failed=0
for pid in "${pull_pids[@]}"; do
wait "$pid" || pull_failed=1
done
exit "$pull_failed"
Loading
Loading