1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-02-21 19:48:53 +02:00

fix(helmExecute) allowWhitespaces in AdditionalParams again (#4466)

This commit is contained in:
Ralf Pannemans 2023-07-13 16:40:57 +02:00 committed by GitHub
parent 9a0b84a953
commit 146c77df52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 2 deletions

View File

@ -479,7 +479,11 @@ func (h *HelmExecute) runHelmCommand(helmParams []string) error {
// expandEnv replaces ${var} or $var in params according to the values of the current environment variables
func expandEnv(params []string) []string {
paramsRaw := strings.Join(params, " ")
expanded := []string{}
return strings.Split(os.ExpandEnv(paramsRaw), " ")
for _, param := range params {
expanded = append(expanded, os.ExpandEnv(param))
}
return expanded
}

View File

@ -310,6 +310,23 @@ func TestRunHelmInstall(t *testing.T) {
{Exec: "helm", Params: []string{"install", "testPackage", ".", "--namespace", "test-namespace", "--create-namespace", "--atomic", "--wait", "--timeout", "525s", "--set-file", "my_script=dothings.sh", "--debug"}},
},
},
{
config: HelmExecuteOptions{
ChartPath: ".",
DeploymentName: "testPackage",
Namespace: "test-namespace",
HelmDeployWaitSeconds: 525,
KeepFailedDeployments: false,
AdditionalParameters: []string{"--set", "auth=Basic user:password"},
TargetRepositoryURL: "https://charts.helm.sh/stable",
TargetRepositoryName: "test",
},
generalVerbose: true,
expectedExecCalls: []mock.ExecCall{
{Exec: "helm", Params: []string{"install", "testPackage", ".", "--namespace", "test-namespace", "--create-namespace", "--atomic", "--wait", "--timeout", "525s", "--set", "auth=Basic user:password", "--debug", "--dry-run"}},
{Exec: "helm", Params: []string{"install", "testPackage", ".", "--namespace", "test-namespace", "--create-namespace", "--atomic", "--wait", "--timeout", "525s", "--set", "auth=Basic user:password", "--debug"}},
},
},
}
for i, testCase := range testTable {