From 3e35d584b00f1701938c5ff83a1f7b715b2e7cac Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 10 Sep 2025 13:41:50 +0000 Subject: [PATCH] Remove --wait-retries flag support and update documentation Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com> --- docs/index.md | 8 +++++--- pkg/state/helmx.go | 19 ++----------------- pkg/state/helmx_test.go | 22 +++++++++++----------- pkg/state/state.go | 2 ++ 4 files changed, 20 insertions(+), 31 deletions(-) diff --git a/docs/index.md b/docs/index.md index 399f356b..59d3442f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -194,8 +194,9 @@ helmDefaults: skipSchemaValidation: false # wait for k8s resources via --wait. (default false) wait: true - # if set and --wait enabled, will retry any failed check on resource state subject to the specified number of retries (default 0) - waitRetries: 3 + # DEPRECATED: waitRetries is no longer supported as the --wait-retries flag was removed from Helm. + # This configuration is ignored and preserved only for backward compatibility. + # waitRetries: 3 # if set and --wait enabled, will wait until all Jobs have been completed before marking the release as successful. It will wait for as long as --timeout (default false, Implemented in Helm3.5) waitForJobs: true # time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks, and waits on pod/pvc/svc/deployment readiness) (default 300) @@ -318,7 +319,8 @@ releases: # --skip-schema-validation flag to helm 'install', 'upgrade' and 'lint', starts with helm 3.16.0 (default false) skipSchemaValidation: false wait: true - waitRetries: 3 + # DEPRECATED: waitRetries is no longer supported - see documentation above + # waitRetries: 3 waitForJobs: true timeout: 60 recreatePods: true diff --git a/pkg/state/helmx.go b/pkg/state/helmx.go index eca4b2cb..b48e6ac8 100644 --- a/pkg/state/helmx.go +++ b/pkg/state/helmx.go @@ -6,7 +6,6 @@ import ( "path/filepath" "slices" "sort" - "strconv" "strings" "github.com/helmfile/chartify" @@ -159,30 +158,16 @@ func (st *HelmState) appendWaitForJobsFlags(flags []string, release *ReleaseSpec } func (st *HelmState) appendWaitFlags(flags []string, helm helmexec.Interface, release *ReleaseSpec, ops *SyncOpts) []string { - var hasWait bool switch { case release.Wait != nil && *release.Wait: - hasWait = true flags = append(flags, "--wait") case ops != nil && ops.Wait: - hasWait = true flags = append(flags, "--wait") case release.Wait == nil && st.HelmDefaults.Wait: - hasWait = true flags = append(flags, "--wait") } - // see https://github.com/helm/helm/releases/tag/v3.15.0 - // https://github.com/helm/helm/commit/fc74964 - if hasWait && helm.IsVersionAtLeast("3.15.0") { - switch { - case release.WaitRetries != nil && *release.WaitRetries > 0: - flags = append(flags, "--wait-retries", strconv.Itoa(*release.WaitRetries)) - case ops != nil && ops.WaitRetries > 0: - flags = append(flags, "--wait-retries", strconv.Itoa(ops.WaitRetries)) - case release.WaitRetries == nil && st.HelmDefaults.WaitRetries > 0: - flags = append(flags, "--wait-retries", strconv.Itoa(st.HelmDefaults.WaitRetries)) - } - } + // Note: --wait-retries flag has been removed from Helm and is no longer supported + // WaitRetries configuration is preserved for backward compatibility but ignored return flags } diff --git a/pkg/state/helmx_test.go b/pkg/state/helmx_test.go index 90bfb83e..d03318cb 100644 --- a/pkg/state/helmx_test.go +++ b/pkg/state/helmx_test.go @@ -129,7 +129,7 @@ func TestAppendWaitFlags(t *testing.T) { helmSpec: HelmSpec{Wait: false}, expected: []string{}, }, - // --wait-retries + // --wait-retries flag has been removed from Helm { name: "release wait and retry unsupported", release: &ReleaseSpec{Wait: &[]bool{true}[0], WaitRetries: &[]int{1}[0]}, @@ -139,12 +139,12 @@ func TestAppendWaitFlags(t *testing.T) { expected: []string{"--wait"}, }, { - name: "release wait and retry supported", + name: "release wait and retry - retries ignored", release: &ReleaseSpec{Wait: &[]bool{true}[0], WaitRetries: &[]int{1}[0]}, syncOpts: nil, helm: testutil.NewVersionHelmExec("3.15.0"), helmSpec: HelmSpec{}, - expected: []string{"--wait", "--wait-retries", "1"}, + expected: []string{"--wait"}, }, { name: "no wait retry", @@ -155,36 +155,36 @@ func TestAppendWaitFlags(t *testing.T) { expected: []string{}, }, { - name: "cli flags wait and retry", + name: "cli flags wait and retry - retries ignored", release: &ReleaseSpec{}, syncOpts: &SyncOpts{Wait: true, WaitRetries: 2}, helm: testutil.NewVersionHelmExec("3.15.0"), helmSpec: HelmSpec{}, - expected: []string{"--wait", "--wait-retries", "2"}, + expected: []string{"--wait"}, }, { - name: "helm defaults wait retry", + name: "helm defaults wait retry - retries ignored", release: &ReleaseSpec{}, syncOpts: nil, helm: testutil.NewVersionHelmExec("3.15.0"), helmSpec: HelmSpec{Wait: true, WaitRetries: 3}, - expected: []string{"--wait", "--wait-retries", "3"}, + expected: []string{"--wait"}, }, { - name: "release wait default retries", + name: "release wait default retries - retries ignored", release: &ReleaseSpec{Wait: &[]bool{true}[0]}, syncOpts: nil, helm: testutil.NewVersionHelmExec("3.15.0"), helmSpec: HelmSpec{WaitRetries: 4}, - expected: []string{"--wait", "--wait-retries", "4"}, + expected: []string{"--wait"}, }, { - name: "release retries default wait", + name: "release retries default wait - retries ignored", release: &ReleaseSpec{WaitRetries: &[]int{5}[0]}, syncOpts: nil, helm: testutil.NewVersionHelmExec("3.15.0"), helmSpec: HelmSpec{Wait: true}, - expected: []string{"--wait", "--wait-retries", "5"}, + expected: []string{"--wait"}, }, } diff --git a/pkg/state/state.go b/pkg/state/state.go index 19d576d7..8af1561a 100644 --- a/pkg/state/state.go +++ b/pkg/state/state.go @@ -163,6 +163,7 @@ type HelmSpec struct { // Wait, if set to true, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful Wait bool `yaml:"wait"` // WaitRetries, if set and --wait enabled, will retry any failed check on resource state, except if HTTP status code < 500 is received, subject to the specified number of retries + // DEPRECATED: This field is ignored as the --wait-retries flag was removed from Helm. Preserved for backward compatibility. WaitRetries int `yaml:"waitRetries"` // WaitForJobs, if set and --wait enabled, will wait until all Jobs have been completed before marking the release as successful. It will wait for as long as --timeout WaitForJobs bool `yaml:"waitForJobs"` @@ -264,6 +265,7 @@ type ReleaseSpec struct { // Wait, if set to true, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful Wait *bool `yaml:"wait,omitempty"` // WaitRetries, if set and --wait enabled, will retry any failed check on resource state, except if HTTP status code < 500 is received, subject to the specified number of retries + // DEPRECATED: This field is ignored as the --wait-retries flag was removed from Helm. Preserved for backward compatibility. WaitRetries *int `yaml:"waitRetries,omitempty"` // WaitForJobs, if set and --wait enabled, will wait until all Jobs have been completed before marking the release as successful. It will wait for as long as --timeout WaitForJobs *bool `yaml:"waitForJobs,omitempty"`