This is an automated email from the ASF dual-hosted git repository.

bugraoz93 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 834385195f5 Fix CI/CD running full matrix on push to release branches 
(v3-X-test) (#68057)
834385195f5 is described below

commit 834385195f525f841d250cc8e6a4e00c51e165b4
Author: Shahar Epstein <[email protected]>
AuthorDate: Fri Jun 5 19:49:58 2026 +0300

    Fix CI/CD running full matrix on push to release branches (v3-X-test) 
(#68057)
    
    On push to release branches like v3-2-test, the full test matrix was
    unconditionally running because _should_run_all_tests_and_versions()
    didn't distinguish between push events to main vs release branches.
    
    Release branch pushes should only run selective tests (based on changed
    files), while canaries (SCHEDULE) and manual triggers (WORKFLOW_DISPATCH)
    still get the full matrix.
    
    Added branch-aware gating: push to release branches now returns False
    from _should_run_all_tests_and_versions() unless other conditions
    (pyproject.toml changes, etc.) require full tests.
    
    Includes test case validating the behavior across different event types
    and branches.
    
    Fixes: #68052
    
    Co-authored-by: Claude Haiku 4.5 <[email protected]>
---
 .../src/airflow_breeze/utils/selective_checks.py   |  4 ++
 dev/breeze/tests/test_selective_checks.py          | 56 ++++++++++++++++++++++
 2 files changed, 60 insertions(+)

diff --git a/dev/breeze/src/airflow_breeze/utils/selective_checks.py 
b/dev/breeze/src/airflow_breeze/utils/selective_checks.py
index d0893c1e6ff..3bdbf9fc985 100644
--- a/dev/breeze/src/airflow_breeze/utils/selective_checks.py
+++ b/dev/breeze/src/airflow_breeze/utils/selective_checks.py
@@ -657,6 +657,10 @@ class SelectiveChecks:
                     f"[warning]Only text non doc files changed in 
{self._github_event}, skip full tests[/]"
                 )
                 return False
+            # On push to release branches (v3-X-test, etc), only run selective 
tests.
+            # Canaries (SCHEDULE) and manual triggers (WORKFLOW_DISPATCH) 
still run full matrix.
+            if self._github_event == GithubEvents.PUSH and 
self._default_branch != "main":
+                return False
             console_print(f"[warning]Running everything because event is 
{self._github_event}[/]")
             return True
         if not self._commit_ref:
diff --git a/dev/breeze/tests/test_selective_checks.py 
b/dev/breeze/tests/test_selective_checks.py
index 9ba1ada757a..2f6863b8bd4 100644
--- a/dev/breeze/tests/test_selective_checks.py
+++ b/dev/breeze/tests/test_selective_checks.py
@@ -4059,3 +4059,59 @@ def test_helm_test_kubernetes_versions(
         default_branch="main",
     )
     assert_outputs_are_printed(expected_outputs, str(stderr))
+
+
[email protected](
+    ("github_event", "default_branch", "expected_all_versions"),
+    [
+        pytest.param(
+            GithubEvents.PUSH,
+            "v3-2-test",
+            "false",
+            id="Push to release branch does not force all versions",
+        ),
+        pytest.param(
+            GithubEvents.SCHEDULE,
+            "main",
+            "true",
+            id="Schedule (canary) forces all versions",
+        ),
+        pytest.param(
+            GithubEvents.WORKFLOW_DISPATCH,
+            "main",
+            "true",
+            id="Workflow dispatch forces all versions",
+        ),
+    ],
+)
[email protected]("os.environ", {"GITHUB_TOKEN": "test_token"})
+@patch("requests.get")
+def test_push_to_release_branch_does_not_force_full_tests(
+    mock_get, github_event, default_branch, expected_all_versions
+):
+    """Test that push to release branches (v3-X-test) does not force full test 
matrix,
+    while canaries (SCHEDULE) and manual triggers still do."""
+    # Mock GitHub API calls for runner_type property (used in PUSH/SCHEDULE 
events)
+    workflow_response = Mock()
+    workflow_response.status_code = 200
+    workflow_response.json.return_value = {"workflow_runs": [{"jobs_url": 
"https://api.github.com/jobs/123"}]}
+    jobs_response = Mock()
+    jobs_response.status_code = 200
+    jobs_response.json.return_value = {
+        "jobs": [{"name": "Basic tests (ubuntu-22.04)", "labels": 
["ubuntu-22.04"]}]
+    }
+    mock_get.side_effect = [workflow_response, jobs_response]
+
+    stderr = SelectiveChecks(
+        files=("airflow-core/src/airflow/models/dag.py",),
+        commit_ref=NEUTRAL_COMMIT,
+        github_event=github_event,
+        pr_labels=(),
+        default_branch=default_branch,
+    )
+    assert_outputs_are_printed(
+        {
+            "all-versions": expected_all_versions,
+        },
+        str(stderr),
+    )

Reply via email to