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

potiuk pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-1-test by this push:
     new e112bb5ed69 [v3-1-test] Fix dry run override for rc command (#61743) 
(#61753)
e112bb5ed69 is described below

commit e112bb5ed69a0e9bf4d7b6987f22be68852883f9
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Feb 10 23:53:55 2026 +0100

    [v3-1-test] Fix dry run override for rc command (#61743) (#61753)
    
    * Override --dry-run mode for mkdir operations in release check
    
    In CI we are runing the release operation in --dry-run mode, and we
    have to make sure that the commands are executed without --dry-run
    in this case because we need to simulate the behaviour and change
    working directories to those directories created.
    
    * Update tests for dry-run mode
    
    * fixup! Update tests for dry-run mode
    
    ---------
    (cherry picked from commit e74a2226d9b24697c6ff585e3b0bdeebc90b6b67)
    
    Co-authored-by: Bugra Ozturk <[email protected]>
    Co-authored-by: Jarek Potiuk <[email protected]>
---
 .../commands/release_candidate_command.py          |  73 ++++++-------
 dev/breeze/tests/test_release_candidate_command.py | 115 +++++++++++++++++----
 2 files changed, 124 insertions(+), 64 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 c20e2e5b0b1..b6fc228bd39 100644
--- a/dev/breeze/src/airflow_breeze/commands/release_candidate_command.py
+++ b/dev/breeze/src/airflow_breeze/commands/release_candidate_command.py
@@ -476,8 +476,10 @@ def clone_asf_repo(version, repo_root):
 
         if is_ci_environment():
             console_print("[info]Running in CI environment - simulating SVN 
checkout")
-            # Create empty directory structure to simulate svn checkout
-            run_command(["mkdir", "-p", f"{repo_root}/asf-dist/dev/airflow"], 
check=True)
+            # Create empty directory structure to simulate svn checkout 
(override dry-run if specified)
+            run_command(
+                ["mkdir", "-p", f"{repo_root}/asf-dist/dev/airflow"], 
check=True, dry_run_override=False
+            )
             console_print("[success]Simulated ASF repo checkout in CI")
             return
 
@@ -520,9 +522,11 @@ def move_artifacts_to_svn(
     if confirm_action("Do you want to move artifacts to SVN?"):
         os.chdir(f"{repo_root}/asf-dist/dev/airflow")
         if is_ci_environment():
-            console_print("[info]Running in CI environment - simulating SVN 
mkdir")
-            run_command(["mkdir", "-p", f"{version}"], check=True)
-            run_command(["mkdir", "-p", f"task-sdk/{task_sdk_version}"], 
check=True)
+            console_print(
+                "[info]Running in CI environment - executing mkdir (override 
dry-run mode if specified)"
+            )
+            run_command(["mkdir", "-p", f"{version}"], check=True, 
dry_run_override=False)
+            run_command(["mkdir", "-p", f"task-sdk/{task_sdk_version}"], 
dry_run_override=False, check=True)
         else:
             run_command(["svn", "mkdir", f"{version}"], check=True)
             run_command(["svn", "mkdir", f"task-sdk/{task_sdk_version}"], 
check=True)
@@ -552,23 +556,16 @@ def push_artifacts_to_asf_repo(version, task_sdk_version, 
repo_root):
         if not get_dry_run():
             os.chdir(base_dir)
 
-        if is_ci_environment():
-            console_print("[info]Running in CI environment - simulating SVN 
add and commit")
-            console_print(f"[info]Would run: svn add {version}/* 
task-sdk/{task_sdk_version}/*")
-            console_print(
-                f"[info]Would run: svn commit -m 'Add artifacts for Airflow 
{version} and Task SDK {task_sdk_version}'"
-            )
-        else:
-            run_command(f"svn add {version}/* task-sdk/{task_sdk_version}/*", 
check=True, shell=True)
-            run_command(
-                [
-                    "svn",
-                    "commit",
-                    "-m",
-                    f"Add artifacts for Airflow {version} and Task SDK 
{task_sdk_version}",
-                ],
-                check=True,
-            )
+        run_command(f"svn add {version}/* task-sdk/{task_sdk_version}/*", 
check=True, shell=True)
+        run_command(
+            [
+                "svn",
+                "commit",
+                "-m",
+                f"Add artifacts for Airflow {version} and Task SDK 
{task_sdk_version}",
+            ],
+            check=True,
+        )
         console_print("[success]Files pushed to svn")
         console_print(
             "Verify that the files are available here: 
https://dist.apache.org/repos/dist/dev/airflow/";
@@ -680,16 +677,11 @@ def remove_old_releases(version, task_sdk_version, 
repo_root):
     for old_release in old_releases:
         console_print(f"Removing old Airflow release {old_release}")
         if confirm_action(f"Remove old RC {old_release}?"):
-            if is_ci_environment():
-                console_print("[info]Running in CI environment - simulating 
SVN rm and commit")
-                console_print(f"[info]Would run: svn rm {old_release}")
-                console_print(f"[info]Would run: svn commit -m 'Remove old 
release: {old_release}'")
-            else:
-                run_command(["svn", "rm", old_release], check=True)
-                run_command(
-                    ["svn", "commit", "-m", f"Remove old release: 
{old_release}"],
-                    check=True,
-                )
+            run_command(["svn", "rm", old_release], check=True)
+            run_command(
+                ["svn", "commit", "-m", f"Remove old release: {old_release}"],
+                check=True,
+            )
 
     # Remove old Task SDK releases
     task_sdk_path = f"{repo_root}/asf-dist/dev/airflow/task-sdk"
@@ -707,18 +699,11 @@ def remove_old_releases(version, task_sdk_version, 
repo_root):
         for old_release in old_task_sdk_releases:
             console_print(f"Removing old Task SDK release {old_release}")
             if confirm_action(f"Remove old Task SDK RC {old_release}?"):
-                if is_ci_environment():
-                    console_print("[info]Running in CI environment - 
simulating SVN rm and commit")
-                    console_print(f"[info]Would run: svn rm {old_release}")
-                    console_print(
-                        f"[info]Would run: svn commit -m 'Remove old Task SDK 
release: {old_release}'"
-                    )
-                else:
-                    run_command(["svn", "rm", old_release], check=True)
-                    run_command(
-                        ["svn", "commit", "-m", f"Remove old Task SDK release: 
{old_release}"],
-                        check=True,
-                    )
+                run_command(["svn", "rm", old_release], check=True)
+                run_command(
+                    ["svn", "commit", "-m", f"Remove old Task SDK release: 
{old_release}"],
+                    check=True,
+                )
 
     console_print("[success]Old releases removed")
     os.chdir(repo_root)
diff --git a/dev/breeze/tests/test_release_candidate_command.py 
b/dev/breeze/tests/test_release_candidate_command.py
index 4bedc47daab..729f94c06e6 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 unittest import mock
 
 import pytest
 
@@ -181,6 +182,7 @@ def 
test_remove_old_releases_returns_early_when_user_declines(monkeypatch, rc_cm
     assert confirm_prompts == ["Do you want to look for old RCs to remove?"]
 
 
[email protected](os.environ, {"CI": "true"})
 def test_remove_old_releases_removes_confirmed_old_releases(monkeypatch, 
rc_cmd):
     """Test that remove_old_releases works correctly based on CI 
environment."""
     version = "3.1.5rc3"
@@ -244,12 +246,38 @@ def 
test_remove_old_releases_removes_confirmed_old_releases(monkeypatch, rc_cmd)
 
     if is_ci:
         # In CI, should simulate SVN commands
-        assert "[info]Running in CI environment - simulating SVN rm and 
commit" in console_messages
-        assert "[info]Would run: svn rm 3.1.0rc1" in console_messages
-        assert "[info]Would run: svn commit -m 'Remove old release: 3.1.0rc1'" 
in console_messages
+        assert "[success]Old releases removed" in console_messages
+        assert (
+            "The following old Airflow releases should be removed: 
['3.1.0rc1', '3.1.5rc2']"
+            in console_messages
+        )
+        assert "Removing old Airflow release 3.1.0rc1" in console_messages
+        assert "Removing old Airflow release 3.1.5rc2" in console_messages
 
         # Should NOT have any actual svn commands (only rc1 was confirmed)
-        assert run_command_calls == []
+        assert run_command_calls == [
+            (
+                [
+                    "svn",
+                    "rm",
+                    "3.1.0rc1",
+                ],
+                {
+                    "check": True,
+                },
+            ),
+            (
+                [
+                    "svn",
+                    "commit",
+                    "-m",
+                    "Remove old release: 3.1.0rc1",
+                ],
+                {
+                    "check": True,
+                },
+            ),
+        ]
     else:
         # Only rc1 was confirmed, so we should run rm+commit for rc1 only.
         assert run_command_calls == [
@@ -326,6 +354,7 @@ def 
test_remove_old_releases_removes_task_sdk_releases(monkeypatch, rc_cmd):
     assert run_command_calls == []
 
 
[email protected](os.environ, {"CI": "true"})
 def 
test_remove_old_releases_removes_both_airflow_and_task_sdk_releases(monkeypatch,
 rc_cmd):
     """Test that remove_old_releases works correctly based on CI 
environment."""
     version = "3.1.5rc3"
@@ -409,14 +438,59 @@ def 
test_remove_old_releases_removes_both_airflow_and_task_sdk_releases(monkeypa
 
     if is_ci:
         # In CI, should simulate SVN commands
-        assert "[info]Running in CI environment - simulating SVN rm and 
commit" in console_messages
-        assert "[info]Would run: svn rm 3.1.5rc2" in console_messages
-        assert "[info]Would run: svn commit -m 'Remove old release: 3.1.5rc2'" 
in console_messages
-        assert "[info]Would run: svn rm 1.0.6rc1" in console_messages
-        assert "[info]Would run: svn commit -m 'Remove old Task SDK release: 
1.0.6rc1'" in console_messages
+        assert "The following old Airflow releases should be removed: 
['3.1.5rc2']" in console_messages
+        assert "Removing old Airflow release 3.1.5rc2" in console_messages
+        assert (
+            "The following old Task SDK releases should be removed: 
['1.0.6rc1', '1.0.6rc2']"
+            in console_messages
+        )
+        assert "Removing old Task SDK release 1.0.6rc1" in console_messages
 
         # Should NOT have any actual svn commands
-        assert run_command_calls == []
+        assert run_command_calls == [
+            (
+                [
+                    "svn",
+                    "rm",
+                    "3.1.5rc2",
+                ],
+                {
+                    "check": True,
+                },
+            ),
+            (
+                [
+                    "svn",
+                    "commit",
+                    "-m",
+                    "Remove old release: 3.1.5rc2",
+                ],
+                {
+                    "check": True,
+                },
+            ),
+            (
+                [
+                    "svn",
+                    "rm",
+                    "1.0.6rc1",
+                ],
+                {
+                    "check": True,
+                },
+            ),
+            (
+                [
+                    "svn",
+                    "commit",
+                    "-m",
+                    "Remove old Task SDK release: 1.0.6rc1",
+                ],
+                {
+                    "check": True,
+                },
+            ),
+        ]
     else:
         # Both Airflow and Task SDK removals were confirmed
         assert run_command_calls == [
@@ -460,6 +534,7 @@ def 
test_move_artifacts_to_svn_returns_early_when_user_declines(monkeypatch, rc_
     assert confirm_prompts == ["Do you want to move artifacts to SVN?"]
 
 
[email protected](os.environ, {"CI": "true"})
 def test_move_artifacts_to_svn_completes_successfully(monkeypatch, rc_cmd):
     """Test that function completes successfully when user confirms based on 
CI environment."""
     version = "2.10.0rc3"
@@ -504,7 +579,10 @@ def 
test_move_artifacts_to_svn_completes_successfully(monkeypatch, rc_cmd):
 
     if is_ci:
         # In CI, should use mkdir -p instead of svn mkdir
-        assert "[info]Running in CI environment - simulating SVN mkdir" in 
console_messages
+        assert (
+            "[info]Running in CI environment - executing mkdir (override 
dry-run mode if specified)"
+            in console_messages
+        )
         assert any(
             cmd == ["mkdir", "-p", version] and kwargs.get("check") is True
             for cmd, kwargs in run_command_calls
@@ -580,6 +658,7 @@ def 
test_push_artifacts_to_asf_repo_returns_early_when_user_declines(monkeypatch
     assert confirm_prompts == ["Do you want to push artifacts to ASF repo?"]
 
 
[email protected](os.environ, {"CI": "true"})
 def test_push_artifacts_to_asf_repo_completes_successfully(monkeypatch, 
rc_cmd):
     """Test that function completes successfully when user confirms all 
prompts based on CI environment."""
     version = "2.10.0rc3"
@@ -628,18 +707,14 @@ def 
test_push_artifacts_to_asf_repo_completes_successfully(monkeypatch, rc_cmd):
 
     if is_ci:
         # In CI, should simulate SVN commands
-        assert "[info]Running in CI environment - simulating SVN add and 
commit" in console_messages
-        assert f"[info]Would run: svn add {version}/* 
task-sdk/{task_sdk_version}/*" in console_messages
+        assert "Airflow Version Files to push to svn:" in console_messages
+        assert "Task SDK Version Files to push to svn:" in console_messages
+        assert "[success]Files pushed to svn" in console_messages
         assert (
-            f"[info]Would run: svn commit -m 'Add artifacts for Airflow 
{version} and Task SDK {task_sdk_version}'"
+            "Verify that the files are available here: 
https://dist.apache.org/repos/dist/dev/airflow/";
             in console_messages
         )
-
-        # Should NOT have any actual svn commands
-        assert not any(
-            isinstance(cmd, list) and len(cmd) >= 1 and cmd[0] == "svn" for 
cmd, kwargs in run_command_calls
-        )
-        assert not any(isinstance(cmd, str) and cmd.startswith("svn ") for 
cmd, kwargs in run_command_calls)
+        # There are some SVN traces in the code but still they are just 
printing and not actually running any SVN commands in CI
     else:
         # In normal environment, should execute SVN commands
         assert any(

Reply via email to