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

shahar1 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 7b9548d0fcd [v3-4-test] Use get_github_repo to check the release 
candidate remote (#76641) (#76654)
7b9548d0fcd is described below

commit 7b9548d0fcd7aaf2e8f0ce3c8582531992381aaf
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Nov 7 08:37:45 2026 +0200

    [v3-4-test] Use get_github_repo to check the release candidate remote 
(#76641) (#76654)
    
    The RC remote check matched fixed URL substrings. It missed valid
    forms such as ssh host aliases, and accepted apache/airflow-site
    because its URL contains github.com/apache/airflow. Parse the URL
    with get_github_repo, as tag-providers does.
    (cherry picked from commit 3776ea3fd7cda83c699047a6f1acb5e0b85dc0de)
    
    Co-authored-by: Niko Oliveira <[email protected]>
---
 .../commands/release_candidate_command.py          | 16 +++-------------
 dev/breeze/tests/test_release_candidate_command.py | 22 ++++++++++++++++++++++
 2 files changed, 25 insertions(+), 13 deletions(-)

diff --git 
a/dev/breeze/src/airflow_breeze/commands/release_candidate_command.py 
b/dev/breeze/src/airflow_breeze/commands/release_candidate_command.py
index ec86ecc46a0..890847d782b 100644
--- a/dev/breeze/src/airflow_breeze/commands/release_candidate_command.py
+++ b/dev/breeze/src/airflow_breeze/commands/release_candidate_command.py
@@ -35,6 +35,7 @@ from airflow_breeze.commands.common_options import (
 )
 from airflow_breeze.commands.release_management_group import 
release_management_group
 from airflow_breeze.global_constants import (
+    APACHE_AIRFLOW_GITHUB_REPOSITORY,
     TarBallType,
     get_airflow_version,
     get_airflowctl_version,
@@ -44,6 +45,7 @@ from airflow_breeze.utils.confirm import confirm_action
 from airflow_breeze.utils.console import console_print
 from airflow_breeze.utils.custom_param_types import BetterChoice
 from airflow_breeze.utils.environment_check import is_ci_environment
+from airflow_breeze.utils.git_remotes import get_github_repo
 from airflow_breeze.utils.path_utils import (
     AIRFLOW_DIST_PATH,
     AIRFLOW_ROOT_PATH,
@@ -78,19 +80,7 @@ def validate_remote_tracks_apache_airflow(remote_name):
 
     remote_url = result.stdout.strip()
 
-    # Check if it's the apache/airflow repository
-    apache_patterns = [
-        "https://github.com/apache/airflow";,
-        "https://github.com/apache/airflow.git";,
-        "[email protected]:apache/airflow",
-        "[email protected]:apache/airflow.git",
-        "ssh://[email protected]/apache/airflow",
-        "ssh://[email protected]/apache/airflow.git",
-    ]
-
-    is_apache_repo = any(pattern in remote_url for pattern in apache_patterns)
-
-    if not is_apache_repo:
+    if (get_github_repo(remote_url) or "").casefold() != 
APACHE_AIRFLOW_GITHUB_REPOSITORY:
         console_print(f"[error]Remote '{remote_name}' does not track 
apache/airflow!")
         console_print(f"Remote URL: {remote_url}")
         console_print("Expected patterns: apache/airflow")
diff --git a/dev/breeze/tests/test_release_candidate_command.py 
b/dev/breeze/tests/test_release_candidate_command.py
index 1877590a2d4..de1a895d3b1 100644
--- a/dev/breeze/tests/test_release_candidate_command.py
+++ b/dev/breeze/tests/test_release_candidate_command.py
@@ -18,6 +18,7 @@
 from __future__ import annotations
 
 import os
+from types import SimpleNamespace
 from unittest import mock
 
 import pytest
@@ -802,6 +803,27 @@ def test_validate_test_branch_exists(monkeypatch, rc_cmd, 
remote_branches, shoul
         rc_cmd.validate_test_branch_exists("3-4", "origin")
 
 
[email protected](
+    ("remote_url", "should_exit"),
+    [
+        pytest.param("git@github-personal:apache/airflow.git", False, 
id="accepts-ssh-host-alias"),
+        pytest.param("https://github.com/apache/airflow-site.git";, True, 
id="rejects-airflow-site"),
+    ],
+)
+def test_validate_remote_tracks_apache_airflow(monkeypatch, rc_cmd, 
remote_url, should_exit):
+    monkeypatch.setattr(
+        rc_cmd, "run_command", lambda *a, **k: SimpleNamespace(returncode=0, 
stdout=f"{remote_url}\n")
+    )
+    monkeypatch.setattr(rc_cmd, "console_print", lambda *a, **k: None)
+    monkeypatch.setattr(rc_cmd, "confirm_action", lambda *a, **k: False)
+
+    if should_exit:
+        with pytest.raises(SystemExit):
+            rc_cmd.validate_remote_tracks_apache_airflow("upstream")
+    else:
+        rc_cmd.validate_remote_tracks_apache_airflow("upstream")
+
+
 def test_checkout_test_branch_tip_resets_to_remote_tip(monkeypatch, rc_cmd):
     """The beta is tagged from exactly the pushed vX-Y-test tip (checkout + 
hard reset to remote)."""
     run_command_calls: list[list[str]] = []

Reply via email to