@@ -36,107 +36,6 @@ dependencies { runtimeServerDistribution(project(":polaris-server", "distributio
3636
3737val helmTestReportsDir = layout.buildDirectory.dir(" reports" )
3838
39- private val missingDependencyExitCode = 42
40-
41- val helmChecks =
42- """
43- echo "====== Check if helm is installed ======"
44- if ! command -v helm >/dev/null 2>&1; then
45- echo "helm is not installed."
46- # Check if we're on macOS
47- if [[ "${' $' } (uname -s)" == "Darwin" ]]; then
48- # Check if brew is available
49- if command -v brew >/dev/null 2>&1; then
50- echo "Installing helm using Homebrew..."
51- brew install helm
52- else
53- echo "WARNING: Homebrew is not installed. Cannot auto-install helm."
54- echo "Please install Homebrew from https://brew.sh/ or install helm manually."
55- exit $missingDependencyExitCode
56- fi
57- else
58- echo "WARNING: helm is not installed."
59- echo "To install helm, see https://helm.sh/docs/intro/install/"
60- exit $missingDependencyExitCode
61- fi
62- fi
63- """
64-
65- val chartTestingChecks =
66- """
67- echo "====== Check if chart-testing is installed ======"
68- if ! command -v ct >/dev/null 2>&1; then
69- echo "chart-testing is not installed."
70- # Check if we're on macOS
71- if [[ "${' $' } (uname -s)" == "Darwin" ]]; then
72- # Check if brew is available
73- if command -v brew >/dev/null 2>&1; then
74- echo "Installing chart-testing using Homebrew..."
75- brew install chart-testing
76- else
77- echo "WARNING: Homebrew is not installed. Cannot auto-install chart-testing."
78- echo "Please install Homebrew from https://brew.sh/ or install chart-testing manually."
79- exit $missingDependencyExitCode
80- fi
81- else
82- echo "WARNING: chart-testing is not installed."
83- echo "To install chart-testing, see https://github.com/helm/chart-testing."
84- exit $missingDependencyExitCode
85- fi
86- fi
87- """
88-
89- val minikubeChecks =
90- """
91- echo "====== Check if Minikube is installed ======"
92- if ! command -v minikube >/dev/null 2>&1; then
93- echo "Minikube is not installed."
94- echo "To install minikube, see https://minikube.sigs.k8s.io/docs/start/."
95- exit $missingDependencyExitCode
96- fi
97-
98- echo "====== Check if Minikube is running ======"
99- if ! minikube status >/dev/null 2>&1; then
100- echo "Minikube is not running. Starting minikube..."
101- minikube start
102- fi
103- """
104-
105- val kubectlChecks =
106- """
107- echo "====== Check if kubectl is installed ======"
108- if ! command -v kubectl >/dev/null 2>&1; then
109- echo "kubectl is not installed."
110- echo "To install kubectl, see https://kubernetes.io/docs/tasks/tools/"
111- exit $missingDependencyExitCode
112- fi
113- """
114-
115- val helmDocsChecks =
116- """
117- echo "====== Check if helm-docs is installed ======"
118- if ! command -v helm-docs >/dev/null 2>&1; then
119- echo "helm-docs is not installed."
120-
121- # Check if we're on macOS
122- if [[ "${' $' } (uname -s)" == "Darwin" ]]; then
123- # Check if brew is available
124- if command -v brew >/dev/null 2>&1; then
125- echo "Installing helm-docs using Homebrew..."
126- brew install norwoodj/tap/helm-docs
127- else
128- echo "WARNING: Homebrew is not installed. Cannot auto-install helm-docs."
129- echo "Please install Homebrew from https://brew.sh/ or install helm-docs manually."
130- exit $missingDependencyExitCode
131- fi
132- else
133- echo "WARNING: helm-docs is not installed. Skipping documentation generation."
134- echo "To install helm-docs on Linux, download from: https://github.com/norwoodj/helm-docs/releases"
135- exit $missingDependencyExitCode
136- fi
137- fi
138- """
139-
14039val helmTemplateValidation by
14140 tasks.registering(Exec ::class ) {
14241 group = " verification"
@@ -147,7 +46,6 @@ val helmTemplateValidation by
14746 runShellScript(
14847 """
14948 set -e
150- ${helmChecks.trimIndent()}
15149 for f in values.yaml ci/*.yaml; do
15250 echo "Validating helm template with ${' $' } f"
15351 helm template --debug --namespace polaris-ns --values ${' $' } f .
@@ -173,7 +71,6 @@ val helmUnitTest by
17371 runShellScript(
17472 """
17573 set -e
176- ${helmChecks.trimIndent()}
17774 echo "====== Install helm-unittest plugin ======"
17875 helm plugin install https://github.com/helm-unittest/helm-unittest.git || true
17976
@@ -200,8 +97,6 @@ val chartTestingLint by
20097 runShellScript(
20198 """
20299 set -e
203- ${helmChecks.trimIndent()}
204- ${chartTestingChecks.trimIndent()}
205100 ct lint --debug --charts .
206101 """ ,
207102 outputFile,
@@ -234,8 +129,6 @@ val buildMinikubeImages by
234129 """
235130 set -e
236131
237- ${minikubeChecks.trimIndent()}
238-
239132 echo "====== Set up docker environment and build images ======"
240133 eval $(minikube -p minikube docker-env)
241134
@@ -271,11 +164,6 @@ val chartTestingInstall by
271164 """
272165 set -eo pipefail
273166
274- ${helmChecks.trimIndent()}
275- ${minikubeChecks.trimIndent()}
276- ${chartTestingChecks.trimIndent()}
277- ${kubectlChecks.trimIndent()}
278-
279167 echo "====== Create namespace if it doesn't exist ======"
280168 kubectl create namespace polaris-ns --dry-run=client -o yaml | kubectl apply -f -
281169
@@ -307,10 +195,6 @@ val helmDocs by
307195 runShellScript(
308196 """
309197 set -e
310-
311- ${helmChecks.trimIndent()}
312- ${helmDocsChecks.trimIndent()}
313-
314198 echo "====== Generate Helm documentation ======"
315199 helm-docs --chart-search-root=.
316200 """ ,
@@ -356,14 +240,9 @@ fun Exec.runShellScript(script: String, outputFile: File) {
356240 outStream?.close()
357241 val exitValue = executionResult.get().exitValue
358242 if (exitValue != 0 ) {
359- if (exitValue == missingDependencyExitCode) {
360- this .logger.warn(" Missing required executable, skipping task:" )
361- outputFile.readLines().forEach { this .logger.warn(it) }
362- } else {
363- this .logger.error(" Shell script failed with exit code $exitValue :\n " )
364- outputFile.readLines().forEach { this .logger.error(it) }
365- throw GradleException (" Shell script failed with exit code $exitValue " )
366- }
243+ this .logger.error(" Shell script failed with exit code $exitValue :\n " )
244+ outputFile.readLines().forEach { this .logger.error(it) }
245+ throw GradleException (" Shell script failed with exit code $exitValue " )
367246 }
368247 }
369248}
0 commit comments