This is an automated email from the ASF dual-hosted git repository.
potiuk 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 de5c8196de5 Fix release dry-run aborting on a workflow run it never
dispatched (#71131)
de5c8196de5 is described below
commit de5c8196de5104e60b16eee093ba0141561e69f2
Author: PoAn Yang <[email protected]>
AuthorDate: Thu Aug 6 19:50:35 2026 +0900
Fix release dry-run aborting on a workflow run it never dispatched (#71131)
Signed-off-by: PoAn Yang <[email protected]>
---
.../src/airflow_breeze/utils/gh_workflow_utils.py | 9 +++++
dev/breeze/tests/test_gh_workflow_utils.py | 40 ++++++++++++++++++++++
2 files changed, 49 insertions(+)
diff --git a/dev/breeze/src/airflow_breeze/utils/gh_workflow_utils.py
b/dev/breeze/src/airflow_breeze/utils/gh_workflow_utils.py
index caaa7b5ac78..78d19080ea5 100644
--- a/dev/breeze/src/airflow_breeze/utils/gh_workflow_utils.py
+++ b/dev/breeze/src/airflow_breeze/utils/gh_workflow_utils.py
@@ -26,6 +26,7 @@ from shutil import which
from airflow_breeze.global_constants import MIN_GH_VERSION
from airflow_breeze.utils.console import console_print
from airflow_breeze.utils.github import run_gh_command
+from airflow_breeze.utils.shared_options import get_dry_run
def tigger_workflow(workflow_name: str, repo: str, branch: str = "main",
**kwargs):
@@ -56,6 +57,11 @@ def tigger_workflow(workflow_name: str, repo: str, branch:
str = "main", **kwarg
console_print(f"[red]Error running workflow: {result.stderr}[/red]")
sys.exit(1)
+ if get_dry_run():
+ # A dry run dispatches nothing, so `gh run list` comes back empty.
+ console_print(f"[info]Dry run: not looking up or monitoring a run of
{workflow_name}.")
+ return
+
# Wait for a few seconds to start the workflow run
time.sleep(5)
@@ -204,6 +210,9 @@ def trigger_workflow_and_monitor(
**workflow_fields,
)
+ if get_dry_run():
+ return
+
workflow_run_id = get_workflow_run_id(
workflow_name=workflow_name,
repo=repo,
diff --git a/dev/breeze/tests/test_gh_workflow_utils.py
b/dev/breeze/tests/test_gh_workflow_utils.py
new file mode 100644
index 00000000000..084944a525f
--- /dev/null
+++ b/dev/breeze/tests/test_gh_workflow_utils.py
@@ -0,0 +1,40 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+from __future__ import annotations
+
+from unittest import mock
+
+from airflow_breeze.utils.gh_workflow_utils import trigger_workflow_and_monitor
+from airflow_breeze.utils.shared_options import set_dry_run
+
+
[email protected]("airflow_breeze.utils.gh_workflow_utils.monitor_workflow_run")
[email protected]("airflow_breeze.utils.gh_workflow_utils.make_sure_gh_is_installed")
+def test_trigger_workflow_and_monitor_stops_after_the_dispatch_in_dry_run(_,
mock_monitor):
+ """A dry run dispatches nothing, so the empty `gh run list` must not read
as a missing run."""
+ set_dry_run(True)
+ try:
+ trigger_workflow_and_monitor(
+ workflow_name="release-constraints.yml",
+ repo="apache/airflow",
+ version="3.2.0rc1",
+ ref="v3-2-stable",
+ )
+ finally:
+ set_dry_run(False)
+
+ mock_monitor.assert_not_called()