This is an automated email from the ASF dual-hosted git repository.
gopidesu 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 6b7d2ca9ace [v3-1-test] Add better logging for jobs label (#57378)
(#57379)
6b7d2ca9ace is described below
commit 6b7d2ca9ace5a981d725bacfac06d34f0a6b15ae
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Oct 27 21:31:43 2025 +0000
[v3-1-test] Add better logging for jobs label (#57378) (#57379)
(cherry picked from commit 026b70aea6d910fa9d180f378472740539f74ed6)
Co-authored-by: GPK <[email protected]>
---
.../src/airflow_breeze/utils/selective_checks.py | 3 +++
dev/breeze/tests/test_selective_checks.py | 29 ++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/dev/breeze/src/airflow_breeze/utils/selective_checks.py
b/dev/breeze/src/airflow_breeze/utils/selective_checks.py
index 2eb4bb6469e..2d6ee0e9589 100644
--- a/dev/breeze/src/airflow_breeze/utils/selective_checks.py
+++ b/dev/breeze/src/airflow_breeze/utils/selective_checks.py
@@ -1337,6 +1337,9 @@ class SelectiveChecks:
runner_labels = job.get("labels", [])
if "windows-2025" in runner_labels:
continue
+ if not runner_labels:
+ get_console().print("[yellow]No labels found for job
{job_name}.\n", jobs_url)
+ return None
return runner_labels[0]
return None
diff --git a/dev/breeze/tests/test_selective_checks.py
b/dev/breeze/tests/test_selective_checks.py
index f7d0a6e71cf..112f030f7a4 100644
--- a/dev/breeze/tests/test_selective_checks.py
+++ b/dev/breeze/tests/test_selective_checks.py
@@ -2490,6 +2490,35 @@ def test_get_job_label(mock_get):
assert result == "ubuntu-22.04"
+@patch("requests.get")
[email protected]("os.environ", {"GITHUB_TOKEN": "test_token"})
+def test_get_job_label_not_found(mock_get):
+ selective_checks = SelectiveChecks(
+ files=(),
+ github_event=GithubEvents.PULL_REQUEST,
+ github_repository="apache/airflow",
+ github_context_dict={},
+ )
+
+ workflow_response = Mock()
+ workflow_response.status_code = 200
+ workflow_response.json.return_value = {"workflow_runs": [{"jobs_url":
"https://api.github.com/jobs/123"}]}
+
+ jobs_response = Mock()
+ jobs_response.json.return_value = {
+ "jobs": [
+ {"name": "Basic tests (ubuntu-22.04)", "labels": []},
+ {"name": "Other job", "labels": ["ubuntu-22.04"]},
+ ]
+ }
+
+ mock_get.side_effect = [workflow_response, jobs_response]
+
+ result = selective_checks.get_job_label("push", "main")
+
+ assert result is None
+
+
def test_runner_type_pr():
selective_checks = SelectiveChecks(github_event=GithubEvents.PULL_REQUEST)