amoghrajesh commented on code in PR #35880:
URL: https://github.com/apache/airflow/pull/35880#discussion_r1405607578
##########
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.")
Review Comment:
Can we instead say "Error while linting charts"
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]