This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-0-test by this push:
new 844e742115f [v3-0-test] Improve validation of breeze workflow-run
command (#53685) (#53688)
844e742115f is described below
commit 844e742115f6fbf161831364e1f1f1f95535fff2
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Jul 23 23:57:45 2025 +0200
[v3-0-test] Improve validation of breeze workflow-run command (#53685)
(#53688)
The workflow run command validation had few places where the
validation could be improved:
* when you do not specify packages, the workflow has no idea what
to build, so the list of packages should not be empty
* when gh has an old version, some of the functionality might not
work - we are checking gh version to check if it is old enough.
(cherry picked from commit 0dc9105f085906232fbeeb6c2c028bc5d90c607e)
Co-authored-by: Jarek Potiuk <[email protected]>
---
.../airflow_breeze/commands/workflow_commands.py | 5 +++++
dev/breeze/src/airflow_breeze/global_constants.py | 1 +
.../src/airflow_breeze/utils/gh_workflow_utils.py | 21 +++++++++++++++++++++
3 files changed, 27 insertions(+)
diff --git a/dev/breeze/src/airflow_breeze/commands/workflow_commands.py
b/dev/breeze/src/airflow_breeze/commands/workflow_commands.py
index 76de156c7df..45e86f2aa72 100644
--- a/dev/breeze/src/airflow_breeze/commands/workflow_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/workflow_commands.py
@@ -108,6 +108,11 @@ def workflow_run_publish(
airflow_base_version: str | None = None,
apply_commits: str | None = None,
):
+ if len(doc_packages) == 0:
+ get_console().print(
+ "[red]Error: No doc packages provided. Please provide at least one
doc package.[/red]",
+ )
+ sys.exit(1)
if os.environ.get("GITHUB_TOKEN", ""):
get_console().print("\n[warning]Your authentication will use
GITHUB_TOKEN environment variable.")
get_console().print(
diff --git a/dev/breeze/src/airflow_breeze/global_constants.py
b/dev/breeze/src/airflow_breeze/global_constants.py
index 5bab931c8c2..c1331e4d18a 100644
--- a/dev/breeze/src/airflow_breeze/global_constants.py
+++ b/dev/breeze/src/airflow_breeze/global_constants.py
@@ -690,6 +690,7 @@ NUM_RUNS = ""
MIN_DOCKER_VERSION = "24.0.0"
MIN_DOCKER_COMPOSE_VERSION = "2.20.2"
+MIN_GH_VERSION = "2.70.0"
AIRFLOW_SOURCES_FROM = "."
AIRFLOW_SOURCES_TO = "/opt/airflow"
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 1b1e3dabab8..e4f45f976b1 100644
--- a/dev/breeze/src/airflow_breeze/utils/gh_workflow_utils.py
+++ b/dev/breeze/src/airflow_breeze/utils/gh_workflow_utils.py
@@ -17,10 +17,13 @@
from __future__ import annotations
import json
+import re
+import subprocess
import sys
import time
from shutil import which
+from airflow_breeze.global_constants import MIN_GH_VERSION
from airflow_breeze.utils.console import get_console
from airflow_breeze.utils.run_utils import run_command
@@ -63,6 +66,23 @@ def make_sure_gh_is_installed():
"run `gh auth login` to connect your repo to GitHub."
)
sys.exit(1)
+ version_string = subprocess.check_output(["gh", "version"]).decode("utf-8")
+ match = re.search(r"gh version (\d+\.\d+\.\d+)", version_string)
+ if match:
+ version = match.group(1)
+ from packaging.version import Version
+
+ if Version(version) < Version(MIN_GH_VERSION):
+ get_console().print(
+ f"[red]Error! The `gh` tool version is too old. "
+ f"Please upgrade to at least version {MIN_GH_VERSION}[/]"
+ )
+ sys.exit(1)
+ else:
+ get_console().print(
+ "[red]Error! Could not determine the version of the `gh` tool.
Please ensure it is installed correctly.[/]"
+ )
+ sys.exit(1)
def get_workflow_run_id(workflow_name: str, repo: str) -> int:
@@ -178,6 +198,7 @@ def monitor_workflow_run(run_id: str, repo: str):
def trigger_workflow_and_monitor(
workflow_name: str, repo: str, branch: str = "main", monitor=True,
**workflow_fields
):
+ make_sure_gh_is_installed()
tigger_workflow(
workflow_name=workflow_name,
repo=repo,