Repository navigation
Add compat tests against "v3-X-test" branch tip for providers - #76957
sjyangkevin wants to merge 4 commits into
Conversation
03bae2b to
19170e7
Compare
End-to-end run of the new job in my own forkProject CI for this PR is waiting for workflow approval, so I ran the full
What the run shows
The branch tip and the 3.4.0 wheel have the same version number, so the fourth row is what tells them apart. That check is new in this PR since the first push: the job now fails if the installed Airflow was not built from the resolved commit.
What this run does not show
One questionShould the job always read the branch tips from Changes since the first push
|
| env: | ||
| LATEST_RELEASE: ${{ inputs.latest-release }} | ||
| GH_TOKEN: ${{ github.token }} | ||
| REPOSITORY: ${{ github.repository }} |
There was a problem hiding this comment.
| REPOSITORY: ${{ github.repository }} | |
| REPOSITORY: "apache/airflow" |
Under ADIP-12 ("Your PR, Your CI"), workflows run on runners inside the contributor's fork repository where ${{ github.repository }} evaluates to <fork-owner>/airflow.
GitHub only clones the default branch (main) on fork creation; maintenance branches (vX-Y-test) and constraint branches (constraints-*) are not replicated to forks. Querying ${REPOSITORY} causes gh api to return an empty array [], setting targets=[] and causing the compatibility checks to silently no-op on all fork CI runs.
Because apache/airflow is a public repo, runner GITHUB_TOKENs have read access to query its refs directly.
There was a problem hiding this comment.
Thanks for the feedback. Updated in ea2ec7f4d2. Reading from apache/airflow also lets the lookup fail when it finds nothing. The branch of the latest release in the matrix and its constraints branch always exist there, so not finding them means the lookup is broken. Before, the job passed and tested nothing.
| with: | ||
| ref: ${{ matrix.target.sha }} | ||
| persist-credentials: false |
There was a problem hiding this comment.
| with: | |
| ref: ${{ matrix.target.sha }} | |
| persist-credentials: false | |
| with: | |
| repository: apache/airflow | |
| ref: ${{ matrix.target.sha }} | |
| persist-credentials: false |
When repository: is omitted from actions/checkout, it defaults to the runner repository (github.repository).
On fork CI under ADIP-12, the runner tries to check out matrix.target.sha from the contributor's fork repository. Because that SHA only exists on upstream apache/airflow, checkout immediately crashes with:
fatal: reference is not a tree: <sha>.
Explicitly setting repository: apache/airflow ensures git fetches the tree object from upstream.
| timeout-minutes: 80 | ||
| # yamllint disable rule:line-length | ||
| name: Compat ${{ matrix.target.branch }}:P${{ matrix.target.python-version }}:${{ matrix.test-types.description }} | ||
| needs: [find-branch-tips, build-airflow] |
There was a problem hiding this comment.
| needs: [find-branch-tips, build-airflow] | |
| needs: [find-branch-tips, build-airflow] | |
| if: needs.find-branch-tips.outputs.targets != '[]' && needs.find-branch-tips.outputs.targets != '' |
build-airflow has an if guard (if: needs.find-branch-tips.outputs.targets != '[]'), but providers-branch-tip-compatibility-tests is missing it.
In GitHub Actions, matrix expansion happens prior to step execution. If targets is empty ([]), matrix.target: ${{ fromJSON(needs.find-branch-tips.outputs.targets) }} receives an empty list, causing GitHub Actions to fail the workflow run with a syntax error:
The workflow is not valid. Matrix [target] cannot be empty.
Adding this job-level if ensures the job is cleanly skipped without error when no targets are resolved.
There was a problem hiding this comment.
After running some tests. This guard might not be needed. When targets is [], build-airflow is skipped, and GitHub skips a job whose needs include a skipped job unless its if uses always() or a similar function. The test job is skipped before its matrix is expanded, so the run does not fail.
With the change for the first comment, [] is also left only for a matrix without any release: a lookup that finds nothing now fails in Find release branch tips.
| run: | | ||
| for provider in ${REMOVE_PROVIDERS}; do | ||
| echo "Removing incompatible provider: ${provider}" | ||
| rm -vf dist/apache_airflow_providers_${provider/./_}-* |
There was a problem hiding this comment.
| rm -vf dist/apache_airflow_providers_${provider/./_}-* | |
| rm -vf dist/apache_airflow_providers_${provider//./_}-* |
Bash parameter expansion ${provider/./_} (single slash) only replaces the first occurrence of .. If a provider identifier contains multiple dots, subsequent dots remain unmodified, causing the glob to miss the wheel file in dist/ and leaving the incompatible wheel installed.
Using double-slash ${provider//./_} ensures global replacement of all dots with underscores.
There was a problem hiding this comment.
Right, / replaces only the first dot. No provider id has more than one dot today, so nothing is missed. The line is copied from the compatibility job in test-providers.yml, and I'd rather keep the two the same than fix only the copy. I can change both in a separate PR if needed.
| @@ -1724,6 +1750,7 @@ jobs: | |||
| - migration-round-trip | |||
| - mypy-providers | |||
| - providers | |||
| - providers-branch-tip | |||
There was a problem hiding this comment.
Please remove providers-branch-tip from ci-passed's needs list (and from check-timed-out-jobs).
ci-passed is the required status check gate for pull request merges. If providers-branch-tip is in needs, any unstable backport on upstream v3-4-test will cause ci-passed to fail and block all PRs on main that have the full tests needed label.
As noted in the selective_checks.py docstring: "A release branch tip moves independently of the pull request, so a pull request can neither cause nor fix a failure there." Having failures on an external branch tip block unrelated PR merges on main breaks CI reliability. This check should run as an informational/canary check, but it should not be a blocking gate in ci-passed.
There was a problem hiding this comment.
I think you're right that a broken backport on v3-4-test would fail CI passed on every PR with the full tests needed label until the branch is fixed. Removing the job from ci-passed alone would also stop Slack from reporting it, because notify-slack waits for the rest of the run only through ci-passed. I'd move the job to the needs of notify-slack instead. Since this changes what blocks merges, I would appreciate feedback to align on a direction for this. Please see comment below: #76957 (comment)
There was a problem hiding this comment.
Yes, moving it out of ci-passed / check-timed-out-jobs and into notify-slack's needs is 100% the right architecture.
The sole purpose of ci-passed is protecting main against regressions introduced by the PR itself. Holding PRs on main hostage to external branch churn on v3-4-test would cause unnecessary merge gridlock whenever full tests needed is used. Having notify-slack wait on it directly gives the exact behavior we want: scheduled canary runs will alert maintainers on Slack if a backport breaks compatibility, without blocking unrelated PRs.
The tradeoff on workflow-modifying PRs is completely fine and standard in Airflow—reviewers always inspect the individual check runs on workflow PRs before approving anyway.
Also agree on keeping ${provider/./_} in sync with test-providers.yml for now and handling both in a follow-up, and good catch on GHA skipping dependent jobs before matrix expansion. The PR is looking really solid!
There was a problem hiding this comment.
Thanks! I'm holding off on the change for moving it out of ci-passed / check-timed-out-jobs for now while waiting for more feedback, because it means changing what the merge gate leaves out.
The check-ci-gate-needs prek hook (scripts/ci/prek/check_ci_gate_needs.py, added with the auto-merge gate in #75142) requires every job in ci-amd.yml to be in the needs of CI passed, and check-timed-out-jobs to need the same jobs. The only exceptions are listed in EXEMPT_JOBS, which today holds only notify-slack and summarize-warnings: "reporting-only jobs that cannot make a PR wrong". So moving the job out of CI passed means adding it to that list, based on my understanding.
1c9c082 to
ea2ec7f
Compare
Update after review: branch tips from
|
| Step | Evidence in the log |
|---|---|
The branch tip is read from apache/airflow |
v3-4-test: 6a6baff34dda9eea30c373d7412a2f871a6467fb (Find release branch tips) |
It is checked out from apache/airflow |
Syncing repository: apache/airflow, HEAD is now at 6a6baff (Build Airflow from v3-4-test) |
| The wheels are built from that commit | git_version of the airflow-core wheel: .release:6a6baff34d… |
| The tests install that build | Installed apache-airflow-core 3.4.0 git_version: .release:6a6baff34d… (Compat v3-4-test) |
| Provider tests | 33,683 passed, 608 skipped, the same counts as Compat 3.4.0 in the same run |
Question: should a failure on the branch tip block merges?
The new job is in the needs of CI passed and Check for timed-out CI jobs. CI passed is the check main requires before a merge. The job runs on canary runs, on PRs with the full tests needed label, and on PRs that change its workflow. So if a backport breaks a provider test on v3-4-test, every PR with the full tests needed label fails CI passed until the branch is fixed, even when the PR has nothing to do with it. Running it again does not help, because the job picks up the same broken branch tip.
The alternative is to remove the job from CI passed and Check for timed-out CI jobs, and add it to the needs of Notify Slack. Notify Slack waits for the rest of the run only through CI passed, so it needs the job listed directly. It reports every failed job of the run, timeouts included, so a broken branch tip would still show up in Slack after a canary run. The cost: a PR that changes test-providers-branch-tip.yml would no longer be blocked by its own failing job. Reviewers would still see it fail.
1df76c0 to
143d5f8
Compare
The provider compatibility tests only cover Airflow releases from PyPI, so a backport that breaks a provider is found only after the next patch release from that branch is published.
A release branch tip can carry the version number of an Airflow that is already on PyPI, and the tests hide their output when they pass, so the job log did not show which of the two the tests ran against. The test that lists the jobs selecting prek hooks did not know the new job and failed.
Forks lack the release and constraints branches, or keep outdated copies of them, so a run in a fork either found no branch and passed without testing anything, or tested an old copy of the branch. A failed branch lookup passed too: without pipefail, a failing API call inside the pipe still produced an empty list of branches.
143d5f8 to
0f45774
Compare





closes: #54454
What
Today, the provider compatibility tests only run against Airflow versions that are already released on PyPI. Bug fixes for the next patch release are backported to the release branch (
v3-4-testat the moment). So if a backport breaks a provider, we might find out after the release is out. #54454 asks for compatibility tests against thev3-X-testbranch tip, so we can catch this earlier.This PR adds a new workflow,
test-providers-branch-tip.yml, that runs the provider tests frommainagainst Airflow built from the tip of the release branch. It runs next to the existing compatibility jobs and does not change them.How it works
PROVIDERS_COMPATIBILITY_TESTS_MATRIX(3.4.0 today). The job lists thevX-Y-testbranches of the repository and keeps the ones whoseX.Yis at least 3.4 and that have aconstraints-X-Ybranch. Today that is onlyv3-4-test. While the next minor release is in beta, it would be bothv3-4-testandv3-5-test. Once 3.5.0 is released and added to the matrix,v3-4-testdrops out. There is no new list to maintain, and the matrix keeps only published releases, which the OpenLineage e2e compatibility tests also rely on.airflow/git_version).--use-airflow-version wheel) with the branch's constraints (constraints-3-4).The issue suggests installing Airflow from the branch with git (#54070). I tried that first, but it needs a full clone of the repository, it builds the providers Airflow depends on from the branch's outdated copies (which conflict with the branch constraints), and it skips the UI build that some provider tests need. Building wheels avoids all three. Installing them from
distalso pins Airflow, so the resolver cannot replace the branch build with the 3.4.0 release from PyPI, which has the same version number.When it runs
main(twice a day on AMD, twice a day on ARM)full tests neededlabeltest-providers-branch-tip.yml, like this oneIt does not run on every provider PR because the branch tip moves on its own. A provider change is already covered by the 3.4.0 job, and a failure on the branch tip would usually come from a backport that the PR author cannot fix.
Before and after, for a canary run
When the branch tip job fails and the 3.4.0 job in the same run passes, the cause is in a backport since 3.4.0 (
git log 3.4.0..<sha>).The new job is listed in
CI passedandCheck for timed-out CI jobs, so a failure shows up on the canary run and in Slack. I did not add it toFinalize tests, so that a broken backport on a release branch does not stopmainfrom publishing its images. Does this sound right to you?Testing
I ran the steps of the job locally in breeze against
v3-4-testata707ed72f8:git_versionmatches the commit.standardprovider tests had 1227 passed and 9 failed. The same 9 tests failed against released 3.4.0, because my local run did not include theopenlineageprovider. So the branch tip did not break anything there.fabprovider tests, which start the API app and need the compiled UI, had 747 passed.upsert_hitl_detail()in a local commit on top of the branch tip. Only the HITL tests failed, with aTypeError. This shows the job catches a breaking backport, and that the tests really used the branch wheels.I also ran the branch lookup against the GitHub API with different latest releases, to check that it compares versions as numbers (
v2-10-testcomes afterv2-9-test) and skips branches without a constraints branch. The new selective-check outputs have unit tests, andtest_selective_checks.pyandtest_verification_plan.pypass. The workflow itself can only run on GitHub, and this PR changes it, so its CI runs the new job.Was generative AI tooling used to co-author this PR?
Generated-by: [Claude Code (Fable 5.2)] following the guidelines
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.