11package com.cloudogu.gitopsbuildlib.validation
22
3- import com.cloudogu.gitopsbuildlib.docker.DockerWrapper
4-
53class HelmKubeval extends Validator {
64
75 HelmKubeval (def script ) {
@@ -11,33 +9,16 @@ class HelmKubeval extends Validator {
119 @Override
1210 void validate (String targetDirectory , Map config , Map deployments ) {
1311 if (deployments. containsKey(' helm' )) {
14- if (deployments. helm. repoType == ' GIT' ) {
15- // script.dir("${targetDirectory}/chart") {
16- // def git = (deployments.helm.containsKey('credentialsId'))
17- // ? script.cesBuildLib.Git.new(script, deployments.helm.credentialsId)
18- // : script.cesBuildLib.Git.new(script)
19- // git url: deployments.helm.repoUrl, branch: 'main', changelog: false, poll: false
20- //
21- // if(deployments.helm.containsKey('version') && deployments.helm.version) {
22- // git.checkout(deployments.helm.version)
23- // }
24- // }
25-
26- def chartPath = ' '
27- if (deployments. helm. containsKey(' chartPath' )) {
28- chartPath = deployments. helm. chartPath
29- }
3012
31- withDockerImage(config. image) {
32- script. sh " helm kubeval chart/${ chartPath} -v ${ config.k8sSchemaVersion} "
33- }
13+ def chartDir = ' '
14+ if (deployments. helm. containsKey(' chartPath' )) {
15+ chartDir = deployments. helm. chartPath
16+ } else if ( deployments. helm. containsKey(' chartName' )) {
17+ chartDir = deployments. helm. chartName
18+ }
3419
35- } else if (deployments. helm. repoType == ' HELM' ) {
36- withDockerImage(config. image) {
37- script. sh " helm repo add chartRepo ${ deployments.helm.repoUrl} "
38- script. sh " helm repo update"
39- script. sh " helm kubeval chartRepo/${ deployments.helm.chartName} --version=${ deployments.helm.version} -v ${ config.k8sSchemaVersion} "
40- }
20+ withDockerImage(config. image) {
21+ script. sh " helm kubeval chart/${ chartDir} -v ${ config.k8sSchemaVersion} "
4122 }
4223 }
4324 }
0 commit comments