This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v3-4-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-4-test by this push:
new 669f3b4acbc [v3-4-test] Run automatic backport PRs on RunsOn runners
(#75749) (#75792)
669f3b4acbc is described below
commit 669f3b4acbc21bb9af3ec850731e77a80fcb18af
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Oct 27 21:53:33 2026 +0100
[v3-4-test] Run automatic backport PRs on RunsOn runners (#75749) (#75792)
Backport PRs opened by cherry_picker are authored by github-actions[bot],
so the blanket "bot PR means public runners" rule sent them to public
runners although a committer's merge or manual dispatch started them and
the code is already on main.
Route a PR to RunsOn when it is authored by github-actions[bot], its head
ref starts with backport- and its head repo is apache/airflow. Dependabot,
ci-upgrade-* PRs, other bots and fork PRs stay on public runners.
(cherry picked from commit 4ace0a1deb7f1df9e0a008aec7e22423611fa4a2)
Co-authored-by: Shahar Epstein <[email protected]>
---
dev/breeze/doc/ci/04_selective_checks.md | 7 ++-
.../src/airflow_breeze/utils/selective_checks.py | 17 ++++---
dev/breeze/tests/test_selective_checks.py | 57 ++++++++++++++++++++--
3 files changed, 70 insertions(+), 11 deletions(-)
diff --git a/dev/breeze/doc/ci/04_selective_checks.md
b/dev/breeze/doc/ci/04_selective_checks.md
index 4d0af1a220c..12f36559984 100644
--- a/dev/breeze/doc/ci/04_selective_checks.md
+++ b/dev/breeze/doc/ci/04_selective_checks.md
@@ -748,8 +748,11 @@ RunsOn (see below). The `runner-type` output is decided as
follows, first match
also still be on the PR: a re-run reuses the labels of its original event,
so they are checked
against the PR's current ones. If the PR or its reviews cannot be read, the
label is ignored as well.
7. PRs with the `non committer build` label use public runners.
-8. PRs opened by a bot (Dependabot and the like), or from a `dependabot/`
branch, use public runners:
- they carry code nobody has reviewed yet.
+8. PRs opened by a bot (Dependabot, the `ci-upgrade-*` PRs and the like), or
from a `dependabot/` branch,
+ use public runners: they carry code nobody has reviewed yet. The exception
is a backport PR: one
+ authored by `github-actions[bot]` (matched on the exact login) from a
`backport-*` branch (the name
+ `cherry_picker` gives it) of `apache/airflow`. A committer's merge started
it, or a user with write
+ access dispatched it for a commit they chose. It continues with rule 9; the
same PR from a fork does not.
9. PRs from a branch of `apache/airflow` use RunsOn; PRs from forks use public
runners.
Labels are read from the event that started the run, and the CI workflows do
not run on `labeled`. After
diff --git a/dev/breeze/src/airflow_breeze/utils/selective_checks.py
b/dev/breeze/src/airflow_breeze/utils/selective_checks.py
index f814662bd50..b5415d504d3 100644
--- a/dev/breeze/src/airflow_breeze/utils/selective_checks.py
+++ b/dev/breeze/src/airflow_breeze/utils/selective_checks.py
@@ -2348,9 +2348,11 @@ class SelectiveChecks:
the PR's own workflow files and breeze, so a fork can request a RunsOn
label directly -
that restriction has to be enforced by the RunsOn stack and the
repository's Actions
settings, not here. Routed there: pushes, schedules and dispatches,
and PRs from
- apache/airflow branches except bots' (e.g. Dependabot's). A fork PR
goes there while it
- carries the ``use self-hosted runners`` label, a committer has
approved its head commit and
- no committer's request for changes is outstanding.
+ apache/airflow branches except bots' (e.g. Dependabot's and the
``ci-upgrade-*`` PRs),
+ except the backport PRs that ``cherry_picker`` opens as
``github-actions[bot]`` from
+ ``backport-*`` branches; a committer's merge or a dispatch by a user
with write access started
+ those. A fork PR goes there while it carries the ``use self-hosted
runners`` label, a
+ committer has approved its head commit and no committer's request for
changes is outstanding.
The repository variable ``USE_PUBLIC_RUNNERS=true`` moves every run
back to public runners.
"""
if self._github_repository != APACHE_AIRFLOW_GITHUB_REPOSITORY:
@@ -2370,9 +2372,12 @@ class SelectiveChecks:
pull_request = self._github_context_dict.get("event",
{}).get("pull_request", {})
# The PR author, not github.actor: a committer rebasing a Dependabot
PR becomes the actor.
# The branch too: anyone can open their own PR from a Dependabot
branch.
- if (pull_request.get("user") or {}).get("type") == "Bot" or (
- pull_request.get("head", {}).get("ref",
"").startswith("dependabot/")
- ):
+ user = pull_request.get("user") or {}
+ head_ref = pull_request.get("head", {}).get("ref", "")
+ is_automatic_backport = user.get("login") == "github-actions[bot]" and
head_ref.startswith(
+ "backport-"
+ )
+ if not is_automatic_backport and (user.get("type") == "Bot" or
head_ref.startswith("dependabot/")):
return False
# A PR from a deleted fork has no head repo.
head_repo = (pull_request.get("head", {}).get("repo") or
{}).get("full_name")
diff --git a/dev/breeze/tests/test_selective_checks.py
b/dev/breeze/tests/test_selective_checks.py
index da53666267f..f2e8e05e298 100644
--- a/dev/breeze/tests/test_selective_checks.py
+++ b/dev/breeze/tests/test_selective_checks.py
@@ -4931,11 +4931,22 @@ def _no_runner_variables(monkeypatch):
monkeypatch.delenv("USE_IN_MEMORY_DOCKER", raising=False)
-def _pull_request_context(head_repo: str | None, author_type: str = "User") ->
dict[str, Any]:
- head = {"repo": {"full_name": head_repo} if head_repo else None, "sha":
HEAD_SHA}
+def _pull_request_context(
+ head_repo: str | None,
+ author_type: str = "User",
+ author_login: str = "someone",
+ head_ref: str = "feature",
+) -> dict[str, Any]:
+ head = {"repo": {"full_name": head_repo} if head_repo else None, "sha":
HEAD_SHA, "ref": head_ref}
return {
"run_id": 42,
- "event": {"pull_request": {"number": 7, "head": head, "user": {"type":
author_type}}},
+ "event": {
+ "pull_request": {
+ "number": 7,
+ "head": head,
+ "user": {"type": author_type, "login": author_login},
+ }
+ },
}
@@ -4978,6 +4989,46 @@ def _pull_request_context(head_repo: str | None,
author_type: str = "User") -> d
'["ubuntu-22.04"]',
id="bot PR from an apache/airflow branch uses public runners",
),
+ pytest.param(
+ GithubEvents.PULL_REQUEST,
+ "apache/airflow",
+ _pull_request_context(
+ "apache/airflow", "Bot", "github-actions[bot]",
"backport-d340be0-v3-4-test"
+ ),
+ (),
+ CI_AMD_PLATFORM,
+ RUNS_ON_AMD,
+ id="automatic backport PR from an apache/airflow branch uses
RunsOn",
+ ),
+ pytest.param(
+ GithubEvents.PULL_REQUEST,
+ "apache/airflow",
+ _pull_request_context(
+ "someone/airflow", "Bot", "github-actions[bot]",
"backport-d340be0-v3-4-test"
+ ),
+ (),
+ CI_AMD_PLATFORM,
+ '["ubuntu-22.04"]',
+ id="backport-named bot PR from a fork uses public runners",
+ ),
+ pytest.param(
+ GithubEvents.PULL_REQUEST,
+ "apache/airflow",
+ _pull_request_context("apache/airflow", "Bot",
"github-actions[bot]", "ci-upgrade-v3-4-test"),
+ (),
+ CI_AMD_PLATFORM,
+ '["ubuntu-22.04"]',
+ id="github-actions bot ci-upgrade PR uses public runners",
+ ),
+ pytest.param(
+ GithubEvents.PULL_REQUEST,
+ "apache/airflow",
+ _pull_request_context("apache/airflow", "Bot", "dependabot[bot]",
"backport-d340be0-v3-4-test"),
+ (),
+ CI_AMD_PLATFORM,
+ '["ubuntu-22.04"]',
+ id="other bot on a backport branch uses public runners",
+ ),
pytest.param(
GithubEvents.PULL_REQUEST,
"apache/airflow",