Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat (kuberenetesDeploy) allow adding a timeout to the helm test commands #4310

Merged
merged 8 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cmd/kubernetesDeploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,14 @@ func runHelmDeploy(config kubernetesDeployOptions, utils kubernetes.DeployUtils,
"--namespace", config.Namespace,
}

if config.DeployTool == "helm" {
testParams = append(testParams, "--timeout", strconv.Itoa(config.HelmTestWaitSeconds))
}

if config.DeployTool == "helm3" {
testParams = append(testParams, "--timeout", fmt.Sprintf("%vs", config.HelmTestWaitSeconds))
}

if config.ShowTestLogs {
testParams = append(
testParams,
Expand Down
11 changes: 11 additions & 0 deletions cmd/kubernetesDeploy_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions cmd/kubernetesDeploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ func TestRunKubernetesDeploy(t *testing.T) {
Namespace: "deploymentNamespace",
DockerConfigJSON: ".pipeline/docker/config.json",
RunHelmTests: true,
HelmTestWaitSeconds: 400,
}

dockerConfigJSON := `{"kind": "Secret","data":{".dockerconfigjson": "ThisIsOurBase64EncodedSecret=="}}`
Expand Down Expand Up @@ -459,6 +460,8 @@ func TestRunKubernetesDeploy(t *testing.T) {
"deploymentName",
"--namespace",
"deploymentNamespace",
"--timeout",
"400s",
}, mockUtils.Calls[2].Params, "Wrong test parameters")
})

Expand All @@ -481,6 +484,7 @@ func TestRunKubernetesDeploy(t *testing.T) {
DockerConfigJSON: ".pipeline/docker/config.json",
RunHelmTests: true,
ShowTestLogs: true,
HelmTestWaitSeconds: 400,
}

dockerConfigJSON := `{"kind": "Secret","data":{".dockerconfigjson": "ThisIsOurBase64EncodedSecret=="}}`
Expand Down Expand Up @@ -538,6 +542,8 @@ func TestRunKubernetesDeploy(t *testing.T) {
"deploymentName",
"--namespace",
"deploymentNamespace",
"--timeout",
"400s",
"--logs",
}, mockUtils.Calls[2].Params, "Wrong test parameters")
})
Expand Down
8 changes: 8 additions & 0 deletions resources/metadata/kubernetesDeploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,14 @@ spec:
- STAGES
- STEPS
default: 300
- name: helmTestWaitSeconds
type: int
description: Number of seconds to wait for any individual Kubernetes operation (like Jobs for hooks). See https://helm.sh/docs/helm/helm_test/#options for further details
scope:
- PARAMETERS
- STAGES
- STEPS
default: 300
- name: helmValues
type: "[]string"
description: List of helm values as YAML file reference or URL (as per helm parameter description for `-f` / `--values`)
Expand Down