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 0bcc119415f Trigger CI-buld dependent static checks on provider's 
project config (#47155)
0bcc119415f is described below

commit 0bcc119415fccacad002f543d2541f2c6bab3ed8
Author: Jarek Potiuk <[email protected]>
AuthorDate: Thu Feb 27 18:10:04 2025 +0100

    Trigger CI-buld dependent static checks on provider's project config 
(#47155)
    
    When provider.yaml or pypyroject.toml changes for a provider, that
    should trigger CI-image bound static checks - because only there
    we verify provider.yaml and it might trigger CI image build to get
    new dependencies that might fail the CI image build.
---
 .../src/airflow_breeze/utils/selective_checks.py   | 12 +++++
 dev/breeze/tests/test_selective_checks.py          | 54 ++++++++++++++++++++++
 2 files changed, 66 insertions(+)

diff --git a/dev/breeze/src/airflow_breeze/utils/selective_checks.py 
b/dev/breeze/src/airflow_breeze/utils/selective_checks.py
index e2966b6895e..75729c7e95d 100644
--- a/dev/breeze/src/airflow_breeze/utils/selective_checks.py
+++ b/dev/breeze/src/airflow_breeze/utils/selective_checks.py
@@ -748,6 +748,7 @@ class SelectiveChecks:
             or self.run_kubernetes_tests
             or self.needs_helm_tests
             or self.pyproject_toml_changed
+            or self.any_provider_yaml_or_pyproject_toml_changed
         )
 
     @cached_property
@@ -975,6 +976,17 @@ class SelectiveChecks:
     def hatch_build_changed(self) -> bool:
         return "hatch_build.py" in self._files
 
+    @cached_property
+    def any_provider_yaml_or_pyproject_toml_changed(self) -> bool:
+        if not self._commit_ref:
+            get_console().print("[warning]Cannot determine changes as commit 
is missing[/]")
+            return False
+        for file in self._files:
+            path_file = Path(file)
+            if path_file.name == "provider.yaml" or path_file.name == 
"pyproject.toml":
+                return True
+        return False
+
     @cached_property
     def pyproject_toml_changed(self) -> bool:
         if not self._commit_ref:
diff --git a/dev/breeze/tests/test_selective_checks.py 
b/dev/breeze/tests/test_selective_checks.py
index fe79b1bb1b6..72026f56749 100644
--- a/dev/breeze/tests/test_selective_checks.py
+++ b/dev/breeze/tests/test_selective_checks.py
@@ -2015,6 +2015,60 @@ def test_helm_tests_trigger_ci_build(files: tuple[str, 
...], expected_outputs: d
     assert_outputs_are_printed(expected_outputs, str(stderr))
 
 
[email protected](
+    "files, expected_outputs,",
+    [
+        pytest.param(
+            ("providers/amazon/provider.yaml",),
+            {
+                "ci-image-build": "true",
+                "prod-image-build": "false",
+                "needs-helm-tests": "false",
+            },
+            id="Amazon provider.yaml",
+        ),
+        pytest.param(
+            ("providers/amazon/pyproject.toml",),
+            {
+                "ci-image-build": "true",
+                "prod-image-build": "false",
+                "needs-helm-tests": "false",
+            },
+            id="Amazon pyproject.toml",
+        ),
+        pytest.param(
+            ("providers/cncf/kubernetes/provider.yaml",),
+            {
+                "ci-image-build": "true",
+                "prod-image-build": "true",
+                "needs-helm-tests": "false",
+            },
+            id="CNCF Kubernetes provider.yaml",
+        ),
+        pytest.param(
+            ("providers/cncf/kubernetes/pyproject.toml",),
+            {
+                "ci-image-build": "true",
+                "prod-image-build": "true",
+                "needs-helm-tests": "false",
+            },
+            id="CNCF Kubernetes pyproject.toml",
+        ),
+    ],
+)
+def test_provider_yaml_or_pyproject_toml_changes_trigger_ci_build(
+    files: tuple[str, ...], expected_outputs: dict[str, str]
+):
+    stderr = SelectiveChecks(
+        files=files,
+        commit_ref=NEUTRAL_COMMIT,
+        github_event=GithubEvents.PULL_REQUEST,
+        pr_labels=(),
+        default_branch="main",
+    )
+    assert_outputs_are_printed(expected_outputs, str(stderr))
+
+
 @pytest.mark.parametrize(
     (
         "github_event, github_actor, github_repository, pr_labels, "

Reply via email to