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
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ List the user-visible scenarios this PR exercises. Example:
#### Ingestion integration tests
<!--
- [ ] I added/updated ingestion integration tests for connector changes.
- [ ] I ran the integration tests covering my changed files locally (PR CI runs only unit tests; the merge queue runs `tests/integration/`).
- [ ] Not applicable (no ingestion changes).
- Files added/updated:
-->
Expand Down
72 changes: 5 additions & 67 deletions .github/workflows/playwright-e2e-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,85 +168,23 @@ concurrency:
cancel-in-progress: ${{ !contains(fromJSON('["pull_request","pull_request_target"]'), github.event_name) || github.event.action != 'labeled' || (github.event.label.name == 'safe to test' && github.event.pull_request.head.repo.full_name != github.repository) }}

jobs:
# Fork-vs-same-repo PR arbitration. GitHub fires BOTH pull_request and
# pull_request_target on every PR event; without a gate the pipeline
# would either double-run same-repo PRs or run fork PRs with the wrong
# secrets. Routing:
# merge_group / schedule / workflow_dispatch → always run
# push (main-scoped cache warm) → always run
# drafts → never run
# labeled event with label != "safe to test" → skip (spurious re-fire)
# same-repo PR → pull_request handles it
# fork PR → pull_request_target
# handles it, must carry
# the "safe to test" label
# Playwright runs only in the merge queue (plus schedule / dispatch / main
# cache-warm pushes); callers skip this workflow on PR events.
gate:
runs-on: ubuntu-latest
permissions:
checks: read
contents: read
pull-requests: read
permissions: {}
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@369769072fe522a3a8a85c03c96af1e5242a1994 # v1.9.1
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|schedule|workflow_dispatch|push) decide true ;;
merge_group|schedule|workflow_dispatch|push) echo "should_run=true" >> "$GITHUB_OUTPUT" ;;
*) echo "should_run=false" >> "$GITHUB_OUTPUT" ;;
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

check-changes:
needs: gate
Expand Down
56 changes: 8 additions & 48 deletions .github/workflows/playwright-postgresql-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,12 @@ on:
required: true
type: boolean
default: true
# Same-repo PRs run under pull_request — unprivileged, secrets absent
# from the runner. These jobs build PR code, populate caches, and
# exchange artifacts.
# Playwright runs only in the merge queue. PRs still trigger the workflow
# because `playwright-summary` is a required check: every job is skipped by
# its `if:` (no runner starts), and GitHub counts a skipped required check
# as passing. With no PR trigger the check would hang at "Expected — waiting".
pull_request:
types:
- labeled
- opened
- synchronize
- reopened
- ready_for_review
# Fork PRs need cloud-connector secrets (TEST_SNOWFLAKE_*, TEST_BQ_*,
# TEST_REDSHIFT_* …) 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 in the reusable workflow). Same-repo
# PRs already ran under pull_request above; the reusable short-circuits
# on them via the head-repo check in the gate job.
pull_request_target:
types:
- labeled
- opened
- synchronize
- reopened
Expand All @@ -94,6 +80,7 @@ permissions:

jobs:
playwright:
if: ${{ github.event_name != 'pull_request' }}
uses: ./.github/workflows/playwright-e2e-reusable.yml
# secrets: inherit passes the full TEST_* / GITHUB_TOKEN set into the
# reusable without re-listing each one; the reusable only reads what it
Expand All @@ -116,24 +103,12 @@ jobs:
coarse_bundle: ${{ github.event_name == 'workflow_dispatch' && inputs.coarse_bundle || true }}
# One retry everywhere while the first-attempt signal is collected: the
# main-health job alerts Slack on every failure and flaky pass so each can
# be fixed. Once main runs clean, flip PRs to zero retries with:
# retries: ${{ !contains(fromJSON('["pull_request","pull_request_target"]'), github.event_name) && 1 || 0 }}
# (numeric, inverted so `0` is the else branch: `X && 0 || 1` would
# short-circuit to 1, and a string breaks the reusable's `type: number`).
# be fixed.
retries: 1

playwright-summary:
name: >-
${{
(
github.event.action == 'labeled'
|| needs.playwright.outputs.gate_result != 'success'
|| needs.playwright.outputs.gate_should_run == 'true'
)
&& 'playwright-summary'
|| 'playwright-summary (skipped)'
}}
if: ${{ always() && !cancelled() }}
name: playwright-summary
if: ${{ always() && !cancelled() && github.event_name != 'pull_request' }}
needs: [playwright]
runs-on: ubuntu-latest
timeout-minutes: 20
Expand Down Expand Up @@ -655,21 +630,6 @@ jobs:
echo "::error::gate did not succeed (result=${{ needs.playwright.outputs.gate_result }}, should_run=${{ needs.playwright.outputs.gate_should_run }}). Refusing synthetic green — this playwright-summary must not report success without a valid gate decision."
exit 1

# Short-circuit when gate explicitly decided should_run=false —
# every upstream job is legitimately `skipped` in that case
# (redundant pull_request_target for a same-repo PR, or fork PR
# without safe-to-test), and the renderer below counts each
# skipped upstream as a "CI/reporting failure" and fails the whole
# check. That's what turned run 30090391086 red on PR #30454 despite
# the pipeline correctly opting out. Match on the exact "false"
# string (not != 'true') so unset outputs never fall through here.
- name: Report gate-skipped run as green
if: ${{ github.event_name != 'merge_group' && needs.playwright.outputs.gate_should_run == 'false' }}
run: |
echo "Gate decided should_run=false for event=${{ github.event_name }}."
echo "This run is intentionally skipped; the authoritative playwright-summary comes from the sibling event's run."
echo "Exiting 0 so this check does not block branch protection."

- name: Render consolidated job summary and gate on results
if: ${{ always() && github.event_name != 'merge_group' && needs.playwright.outputs.gate_should_run == 'true' }}
uses: actions/github-script@v9
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/playwright-postgresql-pr-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ concurrency:

jobs:
publish-playwright-comment:
if: >-
github.event.workflow_run.event == 'pull_request' ||
github.event.workflow_run.event == 'workflow_dispatch'
if: ${{ github.event.workflow_run.event == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- name: Checkout trusted workflow helpers
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/py-tests-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ concurrency:
cancel-in-progress: ${{ github.event_name != 'pull_request_target' || github.event.action != 'labeled' || (github.event.label.name == 'safe to test' && github.event.pull_request.head.repo.full_name != github.repository) }}

jobs:
# Integration tests only; the unit-test and coverage jobs run in py-tests.yml.
# Integration tests only, so PR runs skip everything (merge queue runs the suite);
# the unit-test and coverage jobs run in py-tests.yml.
python:
uses: ./.github/workflows/py-tests-shared.yml
with:
Expand Down
21 changes: 15 additions & 6 deletions .github/workflows/py-tests-shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ jobs:
outputs:
python: ${{ github.event_name == 'workflow_dispatch' && 'true' || steps.filter.outputs.python }}
e2e: ${{ github.event_name == 'workflow_dispatch' && 'true' || steps.filter.outputs.e2e }}
# PRs run unit tests only; the integration suite runs in the merge queue (and on dispatch).
integration: ${{ github.event_name == 'workflow_dispatch' && 'true' || github.event_name == 'merge_group' && steps.filter.outputs.python || 'false' }}
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
Expand Down Expand Up @@ -122,7 +124,7 @@ jobs:
build-distribution:
name: Build Backend Distribution
needs: changes
if: ${{ needs.changes.outputs.python == 'true' }}
if: ${{ needs.changes.outputs.integration == 'true' }}
timeout-minutes: 45
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -168,7 +170,7 @@ jobs:
prepare-spacy-model:
name: Prepare spaCy model
needs: changes
if: ${{ needs.changes.outputs.python == 'true' }}
if: ${{ needs.changes.outputs.python == 'true' && (inputs.run-unit-tests || needs.changes.outputs.integration == 'true') }}
timeout-minutes: 10
runs-on: ubuntu-latest
concurrency:
Expand Down Expand Up @@ -322,7 +324,7 @@ jobs:
py-integration-tests:
name: "Integration Tests (${{ matrix.shard.name }}, ${{ matrix.py-version }})"
needs: [changes, build-distribution, prepare-spacy-model]
if: ${{ needs.changes.outputs.python == 'true' }}
if: ${{ needs.changes.outputs.integration == 'true' }}
timeout-minutes: 180
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -538,6 +540,7 @@ jobs:
env:
CHANGES_RESULT: ${{ needs.changes.result }}
PYTHON_CHANGED: ${{ needs.changes.outputs.python }}
RUN_INTEGRATION: ${{ needs.changes.outputs.integration }}
BUILD_RESULT: ${{ needs.build-distribution.result }}
UNIT_RESULT: ${{ needs.py-unit-tests.result }}
INTEGRATION_RESULT: ${{ needs.py-integration-tests.result }}
Expand All @@ -553,10 +556,15 @@ jobs:
expected_unit="success"
fi

expected_integration="skipped"
if [ "$RUN_INTEGRATION" = "true" ]; then
expected_integration="success"
fi

if [ "$PYTHON_CHANGED" = "true" ]; then
if [ "$BUILD_RESULT" != "success" ] || [ "$INTEGRATION_RESULT" != "success" ] \
if [ "$BUILD_RESULT" != "$expected_integration" ] || [ "$INTEGRATION_RESULT" != "$expected_integration" ] \
|| [ "$UNIT_RESULT" != "$expected_unit" ]; then
echo "Expected Python jobs did not succeed: build=$BUILD_RESULT unit=$UNIT_RESULT (expected $expected_unit) integration=$INTEGRATION_RESULT"
echo "Expected Python jobs did not succeed: build=$BUILD_RESULT integration=$INTEGRATION_RESULT (expected $expected_integration) unit=$UNIT_RESULT (expected $expected_unit)"
exit 1
fi
elif [ "$PYTHON_CHANGED" = "false" ]; then
Expand All @@ -573,7 +581,7 @@ jobs:

py-combine-coverage:
needs: [changes, py-unit-tests, py-integration-tests]
if: ${{ always() && inputs.run-coverage && needs.changes.outputs.python == 'true' && needs.py-unit-tests.result == 'success' && needs.py-integration-tests.result == 'success' }}
if: ${{ always() && inputs.run-coverage && needs.changes.outputs.python == 'true' && needs.py-unit-tests.result == 'success' && contains(fromJSON('["success", "skipped"]'), needs.py-integration-tests.result) }}
runs-on: ubuntu-latest
timeout-minutes: 10
continue-on-error: true
Expand Down Expand Up @@ -611,6 +619,7 @@ jobs:
- name: Prepare coverage files
run: |
cd ingestion
shopt -s nullglob
[ -f coverage-data/coverage-unit/.coverage ] && mv coverage-data/coverage-unit/.coverage .coverage.unit
for dir in coverage-data/coverage-integration-*/; do
shard=$(basename "$dir" | sed 's/coverage-integration-//')
Expand Down
32 changes: 28 additions & 4 deletions skills/pr-checklist/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,36 @@ mvn jacoco:report -pl openmetadata-service
mvn test -pl openmetadata-integration-tests -Dtest=<NewIT>
```

**Ingestion (Python):**
**Ingestion (Python):** PR checks run only the unit tests (`py-tests` → "Unit Tests & Static
Checks"); `tests/integration/` runs **only in the merge queue**. So if the diff touches `ingestion/`,
you MUST run every unit and integration test that covers a changed file locally before opening the PR.
An integration break you skip here first shows up as a merge-queue ejection.

List those tests: the changed test files, plus every test that imports a changed `src/metadata` module:
```bash
source env/bin/activate
cd ingestion
make unit_ingestion_dev_env
python -m pytest tests/unit/<changed_path>/ --cov=metadata.<module> --cov-report=term-missing
changed=$(git diff --name-only --diff-filter=d origin/main...HEAD -- . | sed 's|^ingestion/||')
{
grep -E '^tests/(unit|integration)/.*test_[^/]*\.py$' <<<"$changed"
for f in $(grep -E '^src/metadata/.*\.py$' <<<"$changed"); do
mod=$(sed -E 's|^src/||; s|/__init__\.py$||; s|\.py$||; s|/|.|g' <<<"$f")
grep -rlE --include='*.py' "${mod//./\\.}([^a-zA-Z0-9_]|$)" tests/unit tests/integration
done
} | sort -u > /tmp/affected-tests.txt
```
This finds `from metadata.x.y import z`. It misses `from metadata.x import y`, so also add the
connector's `tests/integration/<connector>/` directory when you change a connector.

Run them. Integration tests need a local server (`./docker/run_local_docker.sh -m no-ui -i false`) and Docker, for testcontainers:
```bash
source ../env/bin/activate
grep '^tests/unit/' /tmp/affected-tests.txt | xargs -r python -m pytest -n auto --cov=metadata --cov-report=term-missing
grep '^tests/integration/' /tmp/affected-tests.txt | xargs -r python -m pytest
```
Put the commands you ran and their pass/fail counts in the PR body, under "Unit tests" and
"Ingestion integration tests". If the list is very large (you changed a shared module like
`metadata/utils/`), run the full unit suite with `nox --no-venv -s unit-tests`. Then run the
integration directories for the connectors you touched, and say in the PR body that you ran a subset.

**Frontend unit tests (Jest):**
```bash
Expand Down Expand Up @@ -165,6 +188,7 @@ Refuse to open the PR if any of these are missing — surface them to the user i
- [ ] Tests section lists actual files and coverage numbers (not placeholders)
- [ ] UI changes have a screen recording attached or marked as TODO with the PR opened as draft
- [ ] Manual test steps are concrete and reproducible
- [ ] `ingestion/` changes: affected unit **and** integration tests were run locally (Step 3), with results in the PR body
- [ ] Cross-layer checks for the change type pass (`make generate`, `mvn spotless:apply`, `yarn lint`, etc.)

## Common Gaps to Watch For
Expand Down
Loading