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

shahar1 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 6773d728c60 Fix tag-providers not finding a push remote without .git 
suffix (#76624)
6773d728c60 is described below

commit 6773d728c60e693562f46a82b3d97208a449393e
Author: Niko Oliveira <[email protected]>
AuthorDate: Fri Nov 6 23:11:32 2026 -0700

    Fix tag-providers not finding a push remote without .git suffix (#76624)
    
    * Fix tag-providers not finding a push remote without .git suffix
    
    A push URL of https://github.com/apache/airflow (no .git) is valid,
    but tag-providers only looked for the literal apache/airflow.git and
    aborted with 'Could not find the remote configured to push to
    apache/airflow'. The 2026-11-03 providers wave hit this and had to
    rewrite the upstream push URL to work around it.
    
    * Address review: use repo constant, cover remote fall-through
    
    Compare against APACHE_AIRFLOW_GITHUB_REPOSITORY instead of a literal.
    Extend the tag-providers test to cover falling through to origin and
    the ValueError when no remote points at apache/airflow, such as a
    similarly named myapache/airflow fork.
---
 .../commands/release_management_commands.py        |  3 +-
 .../tests/test_release_management_commands.py      | 37 +++++++++++++++++++---
 2 files changed, 34 insertions(+), 6 deletions(-)

diff --git 
a/dev/breeze/src/airflow_breeze/commands/release_management_commands.py 
b/dev/breeze/src/airflow_breeze/commands/release_management_commands.py
index 4a50cf9f9c2..385e9e76eeb 100644
--- a/dev/breeze/src/airflow_breeze/commands/release_management_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/release_management_commands.py
@@ -159,6 +159,7 @@ from airflow_breeze.utils.docker_command_utils import (
     fix_ownership_using_docker,
     perform_environment_checks,
 )
+from airflow_breeze.utils.git_remotes import get_github_repo
 from airflow_breeze.utils.github import retrieve_github_token
 from airflow_breeze.utils.helm_chart_utils import chart_version
 from airflow_breeze.utils.packages import (
@@ -1557,7 +1558,7 @@ def tag_providers(
                 # stdout for every remote, which would make the search below 
find nothing.
                 dry_run_override=False,
             )
-            if "apache/airflow.git" in result.stdout:
+            if (get_github_repo(result.stdout.strip()) or "").casefold() == 
APACHE_AIRFLOW_GITHUB_REPOSITORY:
                 found_remote = remote
                 break
         except subprocess.CalledProcessError:
diff --git a/dev/breeze/tests/test_release_management_commands.py 
b/dev/breeze/tests/test_release_management_commands.py
index 4e9dae10338..37bfabdfcb5 100644
--- a/dev/breeze/tests/test_release_management_commands.py
+++ b/dev/breeze/tests/test_release_management_commands.py
@@ -17,6 +17,7 @@
 from __future__ import annotations
 
 import subprocess
+from contextlib import nullcontext
 from pathlib import Path
 from types import SimpleNamespace
 from unittest import mock
@@ -394,7 +395,25 @@ def test_prepare_provider_distributions_skip_git_fetch(
     assert len(fetches) == expected_fetches
 
 
-def test_tag_providers_detects_push_remote_in_dry_run(monkeypatch, tmp_path):
[email protected](
+    ("push_urls", "expected_remote"),
+    [
+        pytest.param({"upstream": "https://github.com/apache/airflow.git"}, 
"upstream", id="upstream"),
+        pytest.param({"upstream": "https://github.com/apache/airflow"}, 
"upstream", id="no-git-suffix"),
+        pytest.param(
+            {
+                "upstream": "https://github.com/someone/airflow.git";,
+                "origin": "[email protected]:apache/airflow.git",
+            },
+            "origin",
+            id="falls-through-to-origin",
+        ),
+        pytest.param(
+            {"upstream": "https://github.com/myapache/airflow.git"}, None, 
id="no-apache-airflow-remote"
+        ),
+    ],
+)
+def test_tag_providers_detects_push_remote_in_dry_run(monkeypatch, tmp_path, 
push_urls, expected_remote):
     commands: list[list[str]] = []
 
     def fake_run_command(cmd, **kwargs):
@@ -402,8 +421,8 @@ def 
test_tag_providers_detects_push_remote_in_dry_run(monkeypatch, tmp_path):
         if cmd[:4] == ["git", "remote", "get-url", "--push"]:
             if shared_options.get_dry_run(kwargs.get("dry_run_override")):
                 return SimpleNamespace(returncode=0, stdout="")
-            if cmd[-1] == "upstream":
-                return SimpleNamespace(returncode=0, 
stdout="https://github.com/apache/airflow.git\n";)
+            if cmd[-1] in push_urls:
+                return SimpleNamespace(returncode=0, 
stdout=f"{push_urls[cmd[-1]]}\n")
             raise subprocess.CalledProcessError(2, cmd)
         return SimpleNamespace(returncode=0, stdout="")
 
@@ -411,13 +430,21 @@ def 
test_tag_providers_detects_push_remote_in_dry_run(monkeypatch, tmp_path):
     monkeypatch.setattr(release_management_commands, "AIRFLOW_DIST_PATH", 
tmp_path)
     (tmp_path / 
"apache_airflow_providers_amazon-9.29.0-py3-none-any.whl").touch()
 
+    expectation = (
+        pytest.raises(ValueError, match="Could not find the remote")
+        if expected_remote is None
+        else nullcontext()
+    )
     shared_options.set_dry_run(True)
     try:
-        release_management_commands.tag_providers.callback(clean_tags=False, 
release_date="2026-08-06")
+        with expectation:
+            
release_management_commands.tag_providers.callback(clean_tags=False, 
release_date="2026-08-06")
     finally:
         shared_options.set_dry_run(False)
 
-    assert ["git", "push", "upstream", "providers-amazon/9.29.0"] in commands
+    pushes = [cmd for cmd in commands if cmd[:2] == ["git", "push"]]
+    expected_pushes = [["git", "push", expected_remote, 
"providers-amazon/9.29.0"]] if expected_remote else []
+    assert pushes == expected_pushes
 
 
 DOCS_DESTINATION = "s3://staging-docs-airflow-apache-org/docs/"

Reply via email to