adutra commented on code in PR #2964: URL: https://github.com/apache/polaris/pull/2964#discussion_r2495121562
########## 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 Review Comment: This one no, because `docker` cannot read files outside the context root. -- 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]
