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 f3ddefccf6 Simplify helm lint pre-commit by using common pre-commit 
code (#35880)
f3ddefccf6 is described below

commit f3ddefccf610833dc8d6012431f372f2af03053c
Author: Jarek Potiuk <[email protected]>
AuthorDate: Mon Nov 27 12:31:01 2023 +0100

    Simplify helm lint pre-commit by using common pre-commit code (#35880)
    
    * Simplify helm lint pre-commit by using common pre-commit code
    
    * Update scripts/ci/pre_commit/pre_commit_helm_lint.py
---
 scripts/ci/pre_commit/pre_commit_helm_lint.py | 35 ++++++++++++++-------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/scripts/ci/pre_commit/pre_commit_helm_lint.py 
b/scripts/ci/pre_commit/pre_commit_helm_lint.py
index bc6f49ad2b..7663fb4672 100755
--- a/scripts/ci/pre_commit/pre_commit_helm_lint.py
+++ b/scripts/ci/pre_commit/pre_commit_helm_lint.py
@@ -18,27 +18,28 @@
 from __future__ import annotations
 
 import os
+import subprocess
 import sys
 from pathlib import Path
 
-AIRFLOW_SOURCES_DIR = Path(__file__).parents[3].resolve()
-
+sys.path.insert(0, str(Path(__file__).parent.resolve()))
+from common_precommit_utils import console, initialize_breeze_precommit
 
-sys.path.insert(0, os.fspath(Path(__file__).parent.resolve()))  # make sure 
common_precommit_utils is imported
-sys.path.insert(0, os.fspath(AIRFLOW_SOURCES_DIR))  # make sure setup is 
imported from Airflow
-sys.path.insert(
-    0, os.fspath(AIRFLOW_SOURCES_DIR / "dev" / "breeze" / "src")
-)  # make sure setup is imported from Airflow
+initialize_breeze_precommit(__name__, __file__)
 
-if __name__ == "__main__":
-    from airflow_breeze.utils.kubernetes_utils import HELM_BIN_PATH, 
make_sure_kubernetes_tools_are_installed
-    from airflow_breeze.utils.run_utils import run_command
+res_setup = subprocess.run(["breeze", "k8s", "setup-env"], check=True)
+if res_setup.returncode != 0:
+    console.print("[red]\nError while setting up k8s environment.")
+    sys.exit(res_setup.returncode)
 
-    make_sure_kubernetes_tools_are_installed()
+AIRFLOW_SOURCES_DIR = Path(__file__).parents[3].resolve()
+HELM_BIN_PATH = AIRFLOW_SOURCES_DIR / ".build" / ".k8s-env" / "bin" / "helm"
 
-    result = run_command(
-        [os.fspath(HELM_BIN_PATH), "lint", ".", "-f", "values.yaml"],
-        check=False,
-        cwd=AIRFLOW_SOURCES_DIR / "chart",
-    )
-    sys.exit(result.returncode)
+result = subprocess.run(
+    [os.fspath(HELM_BIN_PATH), "lint", ".", "-f", "values.yaml"],
+    check=False,
+    cwd=AIRFLOW_SOURCES_DIR / "chart",
+)
+if res_setup.returncode != 0:
+    console.print("[red]\nError while linting charts.")
+    sys.exit(res_setup.returncode)

Reply via email to