adutra commented on code in PR #2964:
URL: https://github.com/apache/polaris/pull/2964#discussion_r2494579662


##########
helm/polaris/build.gradle.kts:
##########
@@ -0,0 +1,284 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+plugins {
+  id("base")
+  id("polaris-spotless")
+}
+
+description = "Apache Polaris (incubating) Helm Chart"
+
+val runtimeServerDistribution by
+  configurations.creating {
+    isCanBeConsumed = false
+    isCanBeResolved = true
+  }
+
+dependencies { runtimeServerDistribution(project(":polaris-server", 
"distributionElements")) }
+
+val helmTestReportsDir = layout.buildDirectory.dir("reports")
+
+val helmTemplateValidation by
+  tasks.registering(Exec::class) {
+    group = "verification"
+    description = "Run 'helm template' validation with all values files"
+
+    val outputFile = 
helmTestReportsDir.get().file("helm-template/validation.log").asFile
+
+    doFirst {
+      outputFile.parentFile.mkdirs()
+      val outStream = outputFile.outputStream()
+      standardOutput = outStream
+      errorOutput = outStream
+    }
+
+    commandLine =
+      listOf(
+        "sh",
+        "-c",
+        """
+          for f in values.yaml ci/*.yaml; do
+            echo "Validating helm template with ${'$'}f"
+            helm template --debug --namespace polaris-ns --values ${'$'}f .
+          done
+        """
+          .trimIndent(),
+      )
+
+    inputs.files(
+      fileTree(projectDir) { include("Chart.yaml", "values.yaml", "ci/*.yaml", 
"templates/**/*") }
+    )
+
+    outputs.cacheIf { true }
+  }
+
+val helmUnitTest by
+  tasks.registering(Exec::class) {
+    group = "verification"
+    description = "Run Helm unit tests"
+
+    val outputFile = helmTestReportsDir.get().file("helm-unit/test.log").asFile
+
+    doFirst {
+      outputFile.parentFile.mkdirs()
+      val outStream = outputFile.outputStream()
+      standardOutput = outStream
+      errorOutput = outStream
+    }
+
+    commandLine =
+      listOf(
+        "sh",
+        "-c",
+        """
+          echo "====== Install helm-unittest plugin ======"
+          helm plugin install 
https://github.com/helm-unittest/helm-unittest.git || true
+
+          echo "====== Run helm unit tests ======"
+          helm unittest .
+        """
+          .trimIndent(),
+      )
+
+    inputs.files(
+      fileTree(projectDir) { include("Chart.yaml", "values.yaml", 
"templates/**/*", "tests/**/*") }
+    )
+
+    outputs.cacheIf { true }
+  }
+
+val chartTestingLint by
+  tasks.registering(Exec::class) {
+    group = "verification"
+    description = "Run chart-testing (lint)"
+
+    val outputFile = helmTestReportsDir.get().file("ct/lint.log").asFile
+
+    doFirst {
+      outputFile.parentFile.mkdirs()
+      val outStream = outputFile.outputStream()
+      standardOutput = outStream
+      errorOutput = outStream
+    }
+
+    commandLine =
+      listOf(
+        "sh",
+        "-c",
+        """
+          ct lint --debug --charts .
+        """
+          .trimIndent(),
+      )
+
+    inputs.files(
+      fileTree(projectDir) { include("Chart.yaml", "values.yaml", "ci/*.yaml", 
"templates/**/*") }
+    )
+
+    outputs.cacheIf { true }
+  }
+
+// Task to build Docker images in minikube's Docker environment
+val buildMinikubeImages by
+  tasks.registering(Exec::class) {
+    group = "build"
+    description = "Build Polaris Docker images in minikube's Docker 
environment"
+
+    workingDir = rootProject.projectDir
+
+    val outputFile = 
helmTestReportsDir.get().file("minikube-images/build.log").asFile
+    val digestFile = 
helmTestReportsDir.get().file("minikube-images/build.sha256").asFile
+
+    doFirst {
+      outputFile.parentFile.mkdirs()
+      digestFile.parentFile.mkdirs()
+      val outStream = outputFile.outputStream()
+      standardOutput = outStream
+      errorOutput = outStream
+    }
+
+    commandLine =
+      listOf(
+        "sh",
+        "-c",
+        """
+    echo "====== Check if minikube is running ======"
+    if ! minikube status >/dev/null 2>&1; then
+      echo "Minikube is not running. Starting minikube..."
+      minikube start
+    fi
+
+    echo "====== Set up docker environment and build images ======"
+    eval $(minikube -p minikube docker-env)
+
+    echo "====== Build server image ======"
+    docker build -t apache/polaris:latest \
+      -f runtime/server/src/main/docker/Dockerfile.jvm \
+      runtime/server
+
+    {
+      docker inspect --format='{{.Id}}' apache/polaris:latest
+    } > ${digestFile.relativeTo(workingDir)}
+  """
+          .trimIndent(),
+      )
+
+    dependsOn(":polaris-server:quarkusBuild")
+
+    inputs.files(runtimeServerDistribution)

Review Comment:
   @snazy I think this is the only task that actually needs this configuration 
as input.
   
   As for the Dockerfile, I don't see any other way to reference it as it is 
not an output of any task (that I know of). Should I create a configuration in 
`polaris-server` to expose it?



-- 
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]

Reply via email to