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


##########
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:
   Yea, a configuration/artifact for the `Dockerfile` is better.
   Other cross-project references can become quite an issue later down the road.



##########
helm/polaris/build.gradle.kts:
##########
@@ -0,0 +1,245 @@
+/*
+ * 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 helmTestReportsDir = layout.buildDirectory.dir("reports")
+
+val helmTemplateValidation by
+  tasks.registering(Exec::class) {
+    group = "verification"
+    description = "Run 'helm template' validation with all values files"
+
+    workingDir = projectDir
+
+    val outputFile = 
helmTestReportsDir.get().file("helm-template/validation.log")
+
+    commandLine =
+      listOf(
+        "sh",
+        "-c",
+        """
+    mkdir -p ${outputFile.asFile.parent}
+    for f in values.yaml ci/*.yaml; do
+      echo "Validating helm template with ${'$'}f"
+      helm template --debug --namespace polaris-ns --values ${'$'}f .
+    done > ${outputFile.asFile} 2>&1
+  """
+          .trimIndent(),
+      )
+
+    inputs.files(
+      fileTree(projectDir) { include("Chart.yaml", "values.yaml", "ci/*.yaml", 
"templates/**/*") }
+    )
+
+    outputs.file(outputFile)
+  }
+
+val helmUnitTest by
+  tasks.registering(Exec::class) {
+    group = "verification"
+    description = "Run Helm unit tests"
+
+    workingDir = projectDir
+
+    val outputFile = helmTestReportsDir.get().file("helm-unit/test.log")
+
+    // Install the plugin if not already installed, then run tests
+    commandLine =
+      listOf(
+        "sh",
+        "-c",
+        """
+    mkdir -p ${outputFile.asFile.parent}
+    helm plugin install https://github.com/helm-unittest/helm-unittest.git 
2>/dev/null || true
+    helm unittest . > ${outputFile.asFile} 2>&1
+  """
+          .trimIndent(),
+      )
+
+    inputs.files(
+      fileTree(projectDir) { include("Chart.yaml", "values.yaml", 
"templates/**/*", "tests/**/*") }
+    )
+
+    outputs.file(outputFile)
+  }
+
+val chartTestingLint by
+  tasks.registering(Exec::class) {
+    group = "verification"
+    description = "Run chart-testing (lint)"
+
+    workingDir = rootProject.projectDir
+
+    val outputFile = helmTestReportsDir.get().file("ct/lint.log")
+
+    commandLine =
+      listOf(
+        "sh",
+        "-c",
+        """
+    mkdir -p ${outputFile.asFile.parent}
+    ct lint --debug --charts ./helm/polaris > ${outputFile.asFile} 2>&1
+  """
+          .trimIndent(),
+      )
+
+    inputs.files(
+      fileTree(projectDir) { include("Chart.yaml", "values.yaml", "ci/*.yaml", 
"templates/**/*") }
+    )
+
+    outputs.file(outputFile)
+  }
+
+// 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
+
+    // Output: file containing SHA digest of built image
+    val outputFile = helmTestReportsDir.get().file("minikube-images.sha256")
+
+    commandLine =
+      listOf(
+        "sh",
+        "-c",
+        """
+    # Check if minikube is running
+    if ! minikube status >/dev/null 2>&1; then
+      echo "Minikube is not running. Starting minikube..."
+      minikube start
+    fi
+
+    # Set up docker environment and build images
+    eval $(minikube -p minikube docker-env)
+
+    # Build server image
+    docker build -t apache/polaris:latest \
+      -f runtime/server/src/main/docker/Dockerfile.jvm \
+      runtime/server
+
+    # Capture image digest
+    mkdir -p ${outputFile.asFile.parent}
+    {
+      docker inspect --format='{{.Id}}' apache/polaris:latest
+    } > ${outputFile.asFile}
+  """
+          .trimIndent(),
+      )
+
+    dependsOn(":polaris-server:quarkusBuild")
+
+    inputs.dir(rootProject.file("runtime/server/build/quarkus-app"))
+    
inputs.file(rootProject.file("runtime/server/src/main/docker/Dockerfile.jvm"))
+
+    outputs.file(outputFile)
+  }
+
+// Task to run chart-testing install on minikube
+val chartTestingInstall by
+  tasks.registering(Exec::class) {
+    group = "verification"
+    description = "Run chart-testing (install) on minikube"
+
+    workingDir = rootProject.projectDir
+
+    val outputFile = helmTestReportsDir.get().file("ct/install.log")
+
+    commandLine =
+      listOf(
+        "sh",
+        "-c",
+        """
+    mkdir -p ${outputFile.asFile.parent}
+
+    # Create namespace if it doesn't exist
+    kubectl create namespace polaris-ns --dry-run=client -o yaml | kubectl 
apply -f -
+
+    # Install fixtures
+    kubectl apply --namespace polaris-ns -f helm/polaris/ci/fixtures
+
+    # Run chart-testing install
+    ct install \
+      --namespace polaris-ns \
+      --debug --charts ./helm/polaris > ${outputFile.asFile} 2>&1
+  """
+          .trimIndent(),
+      )
+
+    inputs.files(

Review Comment:
   Oh, missed the dependsOn at the end.
   SHould be good.



##########
.github/workflows/gradle.yml:
##########
@@ -213,6 +215,7 @@ jobs:
           ./gradlew \
             intTest \
             -x :polaris-runtime-service:intTest \
+            -x :polaris-helm:intTest \

Review Comment:
   Bummer :(



##########
helm/polaris/build.gradle.kts:
##########
@@ -0,0 +1,245 @@
+/*
+ * 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 helmTestReportsDir = layout.buildDirectory.dir("reports")
+
+val helmTemplateValidation by
+  tasks.registering(Exec::class) {
+    group = "verification"
+    description = "Run 'helm template' validation with all values files"
+
+    workingDir = projectDir
+
+    val outputFile = 
helmTestReportsDir.get().file("helm-template/validation.log")
+
+    commandLine =
+      listOf(
+        "sh",
+        "-c",
+        """
+    mkdir -p ${outputFile.asFile.parent}
+    for f in values.yaml ci/*.yaml; do
+      echo "Validating helm template with ${'$'}f"
+      helm template --debug --namespace polaris-ns --values ${'$'}f .
+    done > ${outputFile.asFile} 2>&1
+  """
+          .trimIndent(),
+      )
+
+    inputs.files(
+      fileTree(projectDir) { include("Chart.yaml", "values.yaml", "ci/*.yaml", 
"templates/**/*") }
+    )
+
+    outputs.file(outputFile)
+  }
+
+val helmUnitTest by
+  tasks.registering(Exec::class) {
+    group = "verification"
+    description = "Run Helm unit tests"
+
+    workingDir = projectDir
+
+    val outputFile = helmTestReportsDir.get().file("helm-unit/test.log")
+
+    // Install the plugin if not already installed, then run tests
+    commandLine =
+      listOf(
+        "sh",
+        "-c",
+        """
+    mkdir -p ${outputFile.asFile.parent}
+    helm plugin install https://github.com/helm-unittest/helm-unittest.git 
2>/dev/null || true
+    helm unittest . > ${outputFile.asFile} 2>&1
+  """
+          .trimIndent(),
+      )
+
+    inputs.files(
+      fileTree(projectDir) { include("Chart.yaml", "values.yaml", 
"templates/**/*", "tests/**/*") }
+    )
+
+    outputs.file(outputFile)
+  }
+
+val chartTestingLint by
+  tasks.registering(Exec::class) {
+    group = "verification"
+    description = "Run chart-testing (lint)"
+
+    workingDir = rootProject.projectDir
+
+    val outputFile = helmTestReportsDir.get().file("ct/lint.log")
+
+    commandLine =
+      listOf(
+        "sh",
+        "-c",
+        """
+    mkdir -p ${outputFile.asFile.parent}
+    ct lint --debug --charts ./helm/polaris > ${outputFile.asFile} 2>&1
+  """
+          .trimIndent(),
+      )
+
+    inputs.files(
+      fileTree(projectDir) { include("Chart.yaml", "values.yaml", "ci/*.yaml", 
"templates/**/*") }
+    )
+
+    outputs.file(outputFile)
+  }
+
+// 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
+
+    // Output: file containing SHA digest of built image
+    val outputFile = helmTestReportsDir.get().file("minikube-images.sha256")
+
+    commandLine =
+      listOf(
+        "sh",
+        "-c",
+        """
+    # Check if minikube is running
+    if ! minikube status >/dev/null 2>&1; then
+      echo "Minikube is not running. Starting minikube..."
+      minikube start
+    fi
+
+    # Set up docker environment and build images
+    eval $(minikube -p minikube docker-env)
+
+    # Build server image
+    docker build -t apache/polaris:latest \
+      -f runtime/server/src/main/docker/Dockerfile.jvm \
+      runtime/server
+
+    # Capture image digest
+    mkdir -p ${outputFile.asFile.parent}
+    {
+      docker inspect --format='{{.Id}}' apache/polaris:latest
+    } > ${outputFile.asFile}
+  """
+          .trimIndent(),
+      )
+
+    dependsOn(":polaris-server:quarkusBuild")
+
+    inputs.dir(rootProject.file("runtime/server/build/quarkus-app"))
+    
inputs.file(rootProject.file("runtime/server/src/main/docker/Dockerfile.jvm"))
+
+    outputs.file(outputFile)
+  }
+
+// Task to run chart-testing install on minikube
+val chartTestingInstall by
+  tasks.registering(Exec::class) {
+    group = "verification"
+    description = "Run chart-testing (install) on minikube"
+
+    workingDir = rootProject.projectDir
+
+    val outputFile = helmTestReportsDir.get().file("ct/install.log")
+
+    commandLine =
+      listOf(
+        "sh",
+        "-c",
+        """
+    mkdir -p ${outputFile.asFile.parent}
+
+    # Create namespace if it doesn't exist
+    kubectl create namespace polaris-ns --dry-run=client -o yaml | kubectl 
apply -f -
+
+    # Install fixtures
+    kubectl apply --namespace polaris-ns -f helm/polaris/ci/fixtures
+
+    # Run chart-testing install
+    ct install \
+      --namespace polaris-ns \
+      --debug --charts ./helm/polaris > ${outputFile.asFile} 2>&1
+  """
+          .trimIndent(),
+      )
+
+    inputs.files(
+      fileTree(projectDir) { include("Chart.yaml", "values.yaml", "ci/**/*", 
"templates/**/*") }
+    )
+
+    outputs.file(outputFile)
+
+    // Depend on the images being built in minikube
+    dependsOn(buildMinikubeImages)
+  }
+
+// Task to generate helm documentation
+val helmDocs by
+  tasks.registering(Exec::class) {
+    group = "documentation"
+    description = "Generate Helm chart documentation using helm-docs"
+
+    workingDir = rootProject.projectDir
+
+    commandLine =
+      listOf(
+        "sh",
+        "-c",
+        """
+          helm-docs --chart-search-root=helm
+        """
+          .trimIndent(),
+      )
+
+    inputs.files(fileTree(projectDir) { include("Chart.yaml", "values.yaml", 
"README.md.gotmpl") })
+
+    outputs.file(projectDir.resolve("README.md"))
+  }
+
+val test by
+  tasks.registering {
+    group = "verification"
+    description = "Run all Helm chart tests"
+    dependsOn(helmTemplateValidation, helmUnitTest, chartTestingLint)
+  }
+
+val intTest by
+  tasks.registering {
+    group = "verification"
+    description = "Run Helm chart integration tests on minikube"
+    dependsOn(chartTestingInstall)
+  }
+
+tasks.named("check") { dependsOn(test) }

Review Comment:
   Well, all checks ;)



##########
helm/polaris/build.gradle.kts:
##########
@@ -0,0 +1,247 @@
+import java.io.OutputStream
+
+/*
+ * 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.
+ */
+

Review Comment:
   Let's keep the license header at the very beginning.
   
   ```suggestion
   /*
    * 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.
    */
   
   import java.io.OutputStream
   
   ```



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