Skip to content

Commit 3720c26

Browse files
committed
plain vs helm folder structure fix
Signed-off-by: Marek Markiewka <marek.markiewka@cloudogu.com>
1 parent e2130c7 commit 3720c26

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

src/com/cloudogu/gitopsbuildlib/deployment/Deployment.groovy

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.cloudogu.gitopsbuildlib.deployment
33
abstract class Deployment {
44

55
protected static String getKubectlImage() { 'lachlanevenson/k8s-kubectl:v1.19.3' }
6+
protected String extraResourcesFolder = ""
67

78
static String getConfigDir() { '.config' }
89

@@ -36,11 +37,11 @@ abstract class Deployment {
3637
def sourcePath = gitopsConfig.deployments.sourcePath
3738
def application = gitopsConfig.application
3839

39-
script.sh "mkdir -p ${stage}/${application}/extraResources/"
40+
script.sh "mkdir -p ${stage}/${application}/${extraResourcesFolder}"
4041
script.sh "mkdir -p ${configDir}/"
4142
// copy extra resources like sealed secrets
42-
script.echo "Copying k8s payload from application repo to gitOps Repo: '${sourcePath}/${stage}/*' to '${stage}/${application}/extraResources/'"
43-
script.sh "cp -r ${script.env.WORKSPACE}/${sourcePath}/${stage}/* ${stage}/${application}/extraResources/ || true"
43+
script.echo "Copying k8s payload from application repo to gitOps Repo: '${sourcePath}/${stage}/*' to '${stage}/${application}/${extraResourcesFolder}'"
44+
script.sh "cp -r ${script.env.WORKSPACE}/${sourcePath}/${stage}/* ${stage}/${application}/${extraResourcesFolder} || true"
4445
script.sh "cp ${script.env.WORKSPACE}/*.yamllint.yaml ${configDir}/ || true"
4546
}
4647

src/com/cloudogu/gitopsbuildlib/deployment/helm/Helm.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class Helm extends Deployment {
1515

1616
Helm(def script, def gitopsConfig) {
1717
super(script, gitopsConfig)
18+
this.extraResourcesFolder = "extraResources"
1819
if (gitopsConfig.deployments.helm.repoType == 'GIT') {
1920
chartRepo = new GitRepo(script)
2021
} else if (gitopsConfig.deployments.helm.repoType == 'HELM') {

src/com/cloudogu/gitopsbuildlib/deployment/helm/helmrelease/ArgoCDRelease.groovy

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,10 @@ class ArgoCDRelease extends HelmRelease{
4040
private String createHelmRelease(String chartPath, String application, String mergedValuesFile) {
4141
String helmRelease = ""
4242
dockerWrapper.withHelm {
43-
script.dir("chart/${chartPath}") {
44-
String templateScript = "helm template ${application} . -f ${mergedValuesFile}"
45-
helmRelease = script.sh returnStdout: true, script: templateScript
46-
}
43+
String templateScript = "helm template ${application} chart/${chartPath} -f ${mergedValuesFile}"
44+
helmRelease = script.sh returnStdout: true, script: templateScript
4745
}
46+
4847
// this line removes all empty lines since helm template creates some and the helm validator will throw an error if there are emtpy lines present
4948
helmRelease = helmRelease.replaceAll("(?m)^[ \t]*\r?\n", "")
5049
return helmRelease

0 commit comments

Comments
 (0)