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
4 changes: 4 additions & 0 deletions .github/scripts/build_playwright_shards.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"chromium",
"Basic",
"Ingestion",
"ImportExport",
"DataAssetRulesEnabled",
"DataAssetRulesDisabled",
"SearchRBAC",
Expand All @@ -32,6 +33,7 @@
"chromium": "chromium",
"Basic": "chromium",
"Ingestion": "ingestion",
"ImportExport": "import-export",
"DataAssetRulesEnabled": "data-asset-rules",
"DataAssetRulesDisabled": "data-asset-rules",
"SearchRBAC": "search-rbac",
Expand All @@ -48,6 +50,7 @@
LANE_WORKERS = {
"domain-isolation": 1,
"global-state": 1,
"import-export": 2,
"ingestion": 1,
"reindex": 1,
"search": 1,
Expand Down Expand Up @@ -347,6 +350,7 @@ def lane_bounds(lane: str, mode: str) -> tuple[int, int]:
if lane in {
"domain-isolation",
"global-state",
"import-export",
"ingestion",
"reindex",
"search",
Expand Down
10 changes: 10 additions & 0 deletions .github/scripts/tests/test_playwright_ci_planning.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,16 @@ def test_search_rbac_uses_an_isolated_single_worker_lane():
assert planner.lane_bounds("search-rbac", "full") == (1, 8)


def test_import_export_runs_in_its_own_lane_with_two_workers():
planner = load_script("build_playwright_shards")

assert "ImportExport" in planner.FULL_PROJECTS
assert planner.PROJECT_LANES["ImportExport"] == "import-export"
assert planner.LANE_WORKERS["import-export"] == 2
assert planner.lane_bounds("import-export", "full") == (1, 8)
assert planner.lane_bounds("import-export", "targeted") == (1, 2)


def test_source_glob_matching_is_explicit():
selector = load_script("select_playwright_tests")

Expand Down
239 changes: 232 additions & 7 deletions .github/workflows/playwright-knowledge-graph-postgresql-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,61 @@

name: PostgreSQL PR RDF E2E Tests
on:
merge_group:
workflow_dispatch:
# Same-repo PRs run under pull_request — unprivileged. Merges come
# from merge_group above, full dispatch runs from workflow_dispatch.
pull_request:
types:
- labeled
- opened
- synchronize
- reopened
- ready_for_review
paths:
- ".github/actions/setup-openmetadata-test-environment/action.yml"
- ".github/workflows/playwright-knowledge-graph-postgresql-e2e.yml"
- "docker/run_local_docker.sh"
- "docker/run_local_docker_common.sh"
- "docker/run_local_docker_rdf.sh"
- "docker/validate_compose.py"
- "docker/development/docker-compose-fuseki.yml"
- "docker/development/docker-compose-postgres-fuseki.yml"
- "docs/rdf-local-development.md"
- "openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/rdf/**"
- "openmetadata-service/src/main/java/org/openmetadata/service/rdf/**"
- "openmetadata-service/src/main/java/org/openmetadata/service/resources/glossary/**"
- "openmetadata-service/src/main/java/org/openmetadata/service/resources/rdf/**"
- "openmetadata-service/src/test/java/org/openmetadata/service/apps/bundles/rdf/**"
- "openmetadata-service/src/test/java/org/openmetadata/service/rdf/**"
- "openmetadata-service/src/test/java/org/openmetadata/service/resources/rdf/**"
- "openmetadata-spec/src/main/resources/json/schema/api/data/createGlossaryTerm.json"
- "openmetadata-spec/src/main/resources/json/schema/configuration/glossaryTermRelationSettings.json"
- "openmetadata-spec/src/main/resources/json/schema/entity/data/glossary.json"
- "openmetadata-spec/src/main/resources/json/schema/entity/data/glossaryTerm.json"
- "openmetadata-spec/src/main/resources/rdf/**"
- "openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/KnowledgeGraph.spec.ts"
- "openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/OntologyExplorerRdf.spec.ts"
- "openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/OntologyImportRdf.spec.ts"
- "openmetadata-ui/src/main/resources/ui/playwright.config.ts"
- "openmetadata-ui/src/main/resources/ui/src/components/Glossary/GlossaryHeader/**"
- "openmetadata-ui/src/main/resources/ui/src/components/Glossary/ImportOntologyModal/**"
- "openmetadata-ui/src/main/resources/ui/src/components/KnowledgeGraph3D/**"
- "openmetadata-ui/src/main/resources/ui/src/components/OntologyExplorer/**"
- "openmetadata-ui/src/main/resources/ui/src/rest/importExportAPI.ts"
- "openmetadata-ui/src/main/resources/ui/src/rest/rdfAPI.ts"
- "openmetadata-ui/src/main/resources/ui/src/types/knowledgeGraph.types.ts"
- "openmetadata-ui/src/main/resources/ui/src/utils/TableUtils.tsx"
# Fork PRs need cloud-connector secrets that pull_request events cannot
# access on forks. pull_request_target runs in the base repo's context
# so those secrets resolve, but requires a maintainer to apply the
# "safe to test" label first (enforced by the gate job below). Same-repo
# PRs already ran under pull_request above; the gate short-circuits on
# them via the head-repo check. Same paths filter as pull_request so
# the trigger stays scoped to RDF/ontology work.
pull_request_target:
types:
- labeled
- opened
- synchronize
- reopened
Expand Down Expand Up @@ -57,18 +109,107 @@ permissions:
contents: read

concurrency:
group: playwright-rdf-pr-postgresql-${{ github.event.pull_request.number || github.run_id }}
# Include event_name in the group so pull_request and pull_request_target
# runs on the same PR don't cancel each other — one gates false and skips,
# the other does the real work; sharing a group would let the "skip" event
# cancel an in-flight real run.
group: playwright-rdf-pr-postgresql-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

jobs:
# Fork-vs-same-repo PR arbitration. Same pattern as
# playwright-postgresql-e2e.yml (established by #30485):
# merge_group / workflow_dispatch → always run
# drafts → never run
# labeled event with label != "safe to test" → skip
# same-repo PR + pull_request → run
# fork PR + pull_request_target + "safe to test" (reconciled) → run
# everything else → skip
gate:
runs-on: ubuntu-latest
permissions:
checks: read
contents: read
pull-requests: read
outputs:
should_run: ${{ steps.gate.outputs.should_run }}
steps:
# Team Label atomically removes stale fork approval on synchronize and
# re-adds it only for allowlisted authors. Wait for that reconciliation
# instead of relying on another labeled event: GITHUB_TOKEN label writes
# intentionally do not trigger a new workflow run.
- name: Wait for fork label reconciliation
if: |
github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository
uses: lewagon/wait-on-check-action@9312864dfbc9fd208e9c0417843430751c042800 # v1.7.0
with:
ref: ${{ github.event.pull_request.head.sha }}
check-name: Team Label
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10

- name: Read reconciled fork labels
id: fork-labels
if: |
github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
run: |
set -euo pipefail
labels=$(gh api "/repos/${REPO}/pulls/${PR_NUMBER}" \
--jq '[.labels[].name] | @json')
echo "labels=$labels" >> "$GITHUB_OUTPUT"

- name: Compute gate decision
id: gate
env:
EVENT: ${{ github.event_name }}
ACTION: ${{ github.event.action }}
LABEL: ${{ github.event.label.name }}
HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
BASE_REPO: ${{ github.repository }}
LABELS_JSON: ${{ steps.fork-labels.outputs.labels || toJSON(github.event.pull_request.labels.*.name) }}
IS_DRAFT: ${{ github.event.pull_request.draft }}
run: |
set -euo pipefail
decide() { echo "should_run=$1" >> "$GITHUB_OUTPUT"; exit 0; }
case "$EVENT" in
merge_group|workflow_dispatch) decide true ;;
esac
if [[ "$IS_DRAFT" == "true" ]]; then decide false; fi
if [[ "$ACTION" == "labeled" && "$LABEL" != "safe to test" ]]; then decide false; fi
if [[ "$HEAD_REPO" == "$BASE_REPO" ]]; then
if [[ "$EVENT" == "pull_request" ]]; then decide true; else decide false; fi
fi
# Fork PR — pull_request_target must fire and the reconciled labels
# for the current head SHA must include "safe to test".
if [[ "$EVENT" == "pull_request_target" ]] && \
echo "$LABELS_JSON" | jq -e '. | index("safe to test")' >/dev/null; then
decide true
fi
decide false

build:
needs: gate
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
if: ${{ needs.gate.outputs.should_run == 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ github.sha }}
# pull_request_target runs in the base repo's context, so
# github.sha is the base tip. Explicitly check out the fork's
# PR head SHA under that event so we test the PR's code, not
# the base. actions/checkout@v7 refuses this by default under
# pull_request_target — allow-unsafe-pr-checkout: true opts in;
# build/test steps below run inside docker containers so the
# fork code cannot exfiltrate GITHUB_TOKEN or secrets.
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
allow-unsafe-pr-checkout: true

- name: Setup JDK 21
uses: actions/setup-java@v5
Expand Down Expand Up @@ -99,10 +240,19 @@ jobs:
retention-days: 1

playwright-rdf-postgresql:
name: Playwright RDF (Knowledge Graph + Ontology)
needs: [build]
# Internal display name only. The required-check status
# `Playwright RDF (Knowledge Graph + Ontology)` is published by the
# `playwright-rdf-summary` job below (which uses a dynamic name
# expression), so a redundant sibling event's synthetic-green cannot
# satisfy branch protection before the real pipeline finishes.
name: RDF Playwright execution
needs: [gate, build]
runs-on: ubuntu-latest
if: ${{ !cancelled() && needs.build.result == 'success' && (github.event_name != 'pull_request' || !github.event.pull_request.head.repo.fork) }}
# The previous fork short-circuit (`!github.event.pull_request.head.repo.fork`)
# is now handled by the gate — fork PRs only reach this point when
# pull_request_target fires AND the reconciled labels include
# "safe to test", so it is safe to run the pipeline with secrets.
if: ${{ !cancelled() && needs.gate.outputs.should_run == 'true' && needs.build.result == 'success' }}
environment: test
steps:
- name: Free Disk Space (Ubuntu)
Expand All @@ -119,7 +269,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ github.sha }}
# Same head.sha vs base.sha routing as the build job above.
ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}
allow-unsafe-pr-checkout: true

- name: Prepare temporary distribution directory
run: mkdir -p "${{ runner.temp }}/openmetadata-distribution"
Expand Down Expand Up @@ -244,3 +396,76 @@ jobs:
docker compose -f docker/development/docker-compose-postgres.yml -f docker/development/docker-compose-fuseki.yml down --remove-orphans || true
docker compose -f docker/development/docker-compose-postgres.yml down --remove-orphans || true
sudo rm -rf "${PWD}/docker/development/docker-volume"

# Publishes the required branch-protection check name
# `Playwright RDF (Knowledge Graph + Ontology)` ONLY when this run is
# authorised by the gate. Every other case (redundant sibling event
# for a same-repo PR, fork PR without safe-to-test, draft, spurious
# non-safe-to-test labeled event) publishes a differently-named check
# so branch protection can distinguish "authoritative for this PR
# shape" from "synthetic green / skipped". Without this, GitHub's
# protection UI picks the most-recently-completed run of the required
# name — and the pull_request_target sibling of a same-repo PR would
# finish in ~15s with a green skip while the real pull_request run is
# still compiling, making the PR appear mergeable before tests run.
#
# Decision tree (mirrors the gate + playwright-postgresql-e2e.yml
# pattern from #30476):
# gate succeeds with should_run=true → 'Playwright RDF (Knowledge Graph + Ontology)'
# gate fails (crash / cancelled) → 'Playwright RDF (Knowledge Graph + Ontology)' + hard fail
# labeled event with non-'safe to test' label → '... (label ignored)'
# gate succeeds with should_run=false → '... (skipped)'
playwright-rdf-summary:
name: >-
${{
(
needs.gate.result != 'success'
|| needs.gate.outputs.should_run == 'true'
)
&& 'Playwright RDF (Knowledge Graph + Ontology)'
|| (
github.event.action == 'labeled'
&& github.event.label.name != 'safe to test'
&& 'Playwright RDF (Knowledge Graph + Ontology) (label ignored)'
|| 'Playwright RDF (Knowledge Graph + Ontology) (skipped)'
)
}}
if: ${{ always() && !cancelled() }}
needs: [gate, build, playwright-rdf-postgresql]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
# If gate itself didn't produce a valid decision (crash, cancelled,
# unknown), FAIL loudly rather than silently reporting green.
# Without this guard, `should_run != 'true'` on an unset output
# would fall into the label-ignored/skipped branch above and mask
# the gate failure.
- name: Guard against missing gate decision
if: ${{ needs.gate.result != 'success' }}
run: |
echo "::error::gate did not succeed (result=${{ needs.gate.result }}, should_run=${{ needs.gate.outputs.should_run }}). Refusing synthetic green."
exit 1

# Short-circuit when gate decided should_run=false. The underlying
# jobs are skipped in that case (redundant pull_request_target for
# a same-repo PR, or fork PR without safe-to-test), so there's
# nothing to summarise. The dynamic job name above already routes
# this run to a non-required check name; this step just keeps the
# job outcome at ✅.
- name: Report gate-skipped run as green
if: ${{ needs.gate.outputs.should_run == 'false' }}
run: |
echo "Gate decided should_run=false for event=${{ github.event_name }}."
echo "This run is intentionally skipped; the authoritative required check comes from the sibling event's run."

# Propagate real upstream failures under the required check name
# so the PR fails visibly rather than falling through to green.
- name: Fail on upstream failure
if: |
needs.gate.outputs.should_run == 'true' && (
needs.build.result != 'success' ||
needs.playwright-rdf-postgresql.result != 'success'
)
run: |
echo "::error::Upstream job failure — build=${{ needs.build.result }}, execution=${{ needs.playwright-rdf-postgresql.result }}."
exit 1
3 changes: 3 additions & 0 deletions .github/workflows/playwright-postgresql-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -544,13 +544,15 @@ jobs:
env:
PLAYWRIGHT_IS_OSS: "true"
PW_DEDICATED_INGESTION: "true"
PW_DEDICATED_IMPORT_EXPORT: "true"
PW_EXECUTION_MODE: ${{ needs.detect-changes.outputs.mode }}
PW_LINEAGE_REPRESENTATIVE_ONLY: ${{ needs.detect-changes.outputs.lineage_representative_only }}
run: |
npx playwright test --list --reporter=json \
--project=chromium \
--project=Basic \
--project=Ingestion \
--project=ImportExport \
--project=DataAssetRulesEnabled \
--project=DataAssetRulesDisabled \
--project=SearchRBAC \
Expand Down Expand Up @@ -799,6 +801,7 @@ jobs:
env:
PLAYWRIGHT_IS_OSS: "true"
PW_DEDICATED_INGESTION: "true"
PW_DEDICATED_IMPORT_EXPORT: "true"
run: |
npx playwright test --project=entity-data-setup --reporter=line
test -s playwright/.auth/admin.json
Expand Down
Loading
Loading