Repository navigation
Still attempt upgrades on non-deployed releases - #1043
Conversation
7b2e0b3 to
84db552
Compare
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
Hi @yxxhero! Sorry for the delay, please let me know if theres anything more I need to do to get the workflows approved. Thank you! |
|
Got busy after I put my PR up, so thanks @JadeHayes for finishing the swing on this! |
950fc7e to
3eb7b40
Compare
|
sorry for the delay @yxxhero, got caught up in some other stuff. Thanks for your patience! |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
36f63f3 to
41654ad
Compare
|
Hi @JadeHayes — this PR had gone stale (last updated 2025-04, conflicting with main), so I rebased the work onto current main and force-pushed the branch (maintainer edits were enabled). The original approach and intent are preserved; main adaptations:
All code follows guard-clause style per repo convention. Letting CI validate — happy to adjust if anything looks off to you. |
Rebased onto current main; original PR helmfile#1043 by JadeHayes had gone stale and conflicted beyond repair. helmfile apply used to skip a release when helm-diff reported no changes, regardless of the release state. For a release stuck in a non-deployed state (failed, pending), rerunning apply with an unchanged chart silently reported success while never retrying the upgrade, hiding the failure. - isReleaseInstalled now also reports whether the release is in the "deployed" state, derived from the structured helm list output - helmexec.List returns a structured HelmReleaseOutput parsed from `helm list -o yaml` instead of raw tab-separated text; listReleases passes -o yaml - prepareDiffReleases records the deployed state per release (cached); SkipDiffOnInstall and disable-validation logic now key on deployed so non-deployed releases take the install path - DiffReleases reports a no-change diff on a non-deployed release as changed (helm-diff exit code 2) so apply reruns the upgrade - getDeployedVersion reads the version from the structured chart field - test doubles converted from raw TSV list output to structured values; new regression test covers failed/pending releases being upgraded despite an empty diff The HELMFILE_USE_HELM_STATUS_TO_CHECK_RELEASE_EXISTENCE path cannot distinguish release states and conservatively reports deployed=true, preserving its historical behavior. Fixes helmfile#1043 Signed-off-by: yxxhero <[email protected]>
|
All checks are now green — unit tests (3 helm versions, race-enabled), integration tests (v3.18.6 / v3.22.0 / v4.3.0 × live-output, against real clusters), e2e, lint, builds, and DCO. The integration goldens for |
|
Hey @yxxhero, Jade was doing this on behalf of myself (it's out of my repo). She's no longer in the same organization, so probably isn't following this, but I will take a look at this on Monday, as we'd still love to get this change in. Thanks! |
0dc67c7 to
7885c44
Compare
Rebased onto current main; original PR helmfile#1043 by JadeHayes had gone stale and conflicted beyond repair. helmfile apply used to skip a release when helm-diff reported no changes, regardless of the release state. For a release stuck in a non-deployed state (failed, pending), rerunning apply with an unchanged chart silently reported success while never retrying the upgrade, hiding the failure. - isReleaseInstalled now also reports whether the release is in the "deployed" state, derived from the structured helm list output - helmexec.List returns a structured HelmReleaseOutput parsed from `helm list -o yaml` instead of raw tab-separated text; listReleases passes -o yaml - prepareDiffReleases records the deployed state per release (cached); SkipDiffOnInstall and disable-validation logic now key on deployed so non-deployed releases take the install path - DiffReleases reports a no-change diff on a non-deployed release as changed (helm-diff exit code 2) so apply reruns the upgrade - getDeployedVersion reads the version from the structured chart field - test doubles converted from raw TSV list output to structured values; new regression test covers failed/pending releases being upgraded despite an empty diff The HELMFILE_USE_HELM_STATUS_TO_CHECK_RELEASE_EXISTENCE path cannot distinguish release states and conservatively reports deployed=true, preserving its historical behavior. Fixes helmfile#1043 Signed-off-by: yxxhero <[email protected]>
|
@Secretions sure. thanks so much. |
Rebased onto current main; original PR helmfile#1043 by JadeHayes had gone stale and conflicted beyond repair. helmfile apply used to skip a release when helm-diff reported no changes, regardless of the release state. For a release stuck in a non-deployed state (failed, pending), rerunning apply with an unchanged chart silently reported success while never retrying the upgrade, hiding the failure. - isReleaseInstalled now also reports whether the release is in the "deployed" state, derived from the structured helm list output - helmexec.List returns a structured HelmReleaseOutput parsed from `helm list -o yaml` instead of raw tab-separated text; listReleases passes -o yaml - prepareDiffReleases records the deployed state per release (cached); SkipDiffOnInstall and disable-validation logic now key on deployed so non-deployed releases take the install path - DiffReleases reports a no-change diff on a non-deployed release as changed (helm-diff exit code 2) so apply reruns the upgrade - getDeployedVersion reads the version from the structured chart field - test doubles converted from raw TSV list output to structured values; new regression test covers failed/pending releases being upgraded despite an empty diff The HELMFILE_USE_HELM_STATUS_TO_CHECK_RELEASE_EXISTENCE path cannot distinguish release states and conservatively reports deployed=true, preserving its historical behavior. Fixes helmfile#1043 Signed-off-by: yxxhero <[email protected]>
13b3862 to
cee1675
Compare
|
Tested the current state of this locally, and it lgtm. |
0b8f3ed to
25d5614
Compare
Rebased onto current main; original PR helmfile#1043 by JadeHayes had gone stale and conflicted beyond repair. helmfile apply used to skip a release when helm-diff reported no changes, regardless of the release state. For a release stuck in a non-deployed state (failed, pending), rerunning apply with an unchanged chart silently reported success while never retrying the upgrade, hiding the failure. - isReleaseInstalled now also reports whether the release is in the "deployed" state, derived from the structured helm list output - helmexec.List returns a structured HelmReleaseOutput parsed from `helm list -o yaml` instead of raw tab-separated text; listReleases passes -o yaml - prepareDiffReleases records the deployed state per release (cached); SkipDiffOnInstall and disable-validation logic now key on deployed so non-deployed releases take the install path - DiffReleases reports a no-change diff on a non-deployed release as changed (helm-diff exit code 2) so apply reruns the upgrade - getDeployedVersion reads the version from the structured chart field - test doubles converted from raw TSV list output to structured values; new regression test covers failed/pending releases being upgraded despite an empty diff The HELMFILE_USE_HELM_STATUS_TO_CHECK_RELEASE_EXISTENCE path cannot distinguish release states and conservatively reports deployed=true, preserving its historical behavior. Fixes helmfile#1043 Signed-off-by: yxxhero <[email protected]>
083d21f to
25d5614
Compare
Rebased onto current main; original PR helmfile#1043 by JadeHayes had gone stale and conflicted beyond repair. helmfile apply used to skip a release when helm-diff reported no changes, regardless of the release state. For a release stuck in a non-deployed state (failed, pending), rerunning apply with an unchanged chart silently reported success while never retrying the upgrade, hiding the failure. - isReleaseInstalled now also reports whether the release is in the "deployed" state, derived from the structured helm list output - helmexec.List returns a structured HelmReleaseOutput parsed from `helm list -o yaml` instead of raw tab-separated text; listReleases passes -o yaml - prepareDiffReleases records the deployed state per release (cached); SkipDiffOnInstall and disable-validation logic now key on deployed so non-deployed releases take the install path - DiffReleases reports a no-change diff on a non-deployed release as changed (helm-diff exit code 2) so apply reruns the upgrade - getDeployedVersion reads the version from the structured chart field - test doubles converted from raw TSV list output to structured values; new regression test covers failed/pending releases being upgraded despite an empty diff The HELMFILE_USE_HELM_STATUS_TO_CHECK_RELEASE_EXISTENCE path cannot distinguish release states and conservatively reports deployed=true, preserving its historical behavior. Fixes helmfile#1043 Signed-off-by: yxxhero <[email protected]>
prepareDiffReleases now resolves the deployed state for every diffed
release, which surfaces as an extra helm list call per release. Test
tables must therefore describe the cluster state of every release:
- add absent ({}) entries for fresh-install releases (apply/diff install
cases)
- add deployed entries for releases previously left unlisted that must
keep the skip-on-no-change behavior (skip-needs cases, diff smoke)
- header-only TSV outputs in destroy tests meant 'release exists' under
the old non-empty-string semantics: use deployed entries
- fix one misconverted TSV row (leading-tab indentation shifted the
status column into an empty value)
- TestDiff_2 (no kube-context) entries must use the no-kube-context flag
set
- snapshot for the helm-status existence-check case gains the extra
per-release status check line
- apply golangci-lint fmt (map literal type elision) across tests
Signed-off-by: yxxhero <[email protected]>
With absent-release entries present in the Lists fixture, the getDeployedVersion lookups now succeed with empty output and fall through to the chart-metadata fallback, changing the logged failure from "unexpected list key" to "Failed to get the version for". Signed-off-by: yxxhero <[email protected]>
…rades helmfile diff/apply now resolve the deployed state of every diffed release, which adds a prepare-phase 'Listing releases' line for previously-installed releases, and a no-change diff on a non-deployed release is reported as changed (with its 'Affected releases' block) so apply reruns the upgrade. Signed-off-by: yxxhero <[email protected]>
Signed-off-by: yxxhero <[email protected]>
Signed-off-by: yxxhero <[email protected]>
Signed-off-by: Joaquin Lopez <[email protected]>
…tcode Review fixes for the non-deployed-release handling: - Only run the extra helm list deployed-state probe and force the "changed" result for non-deployed releases when the caller acts on diff results (helmfile apply, or diff --detailed-exitcode). A plain `helmfile diff` no longer lists fresh/failed-but-unchanged releases in "Affected releases are:" with no exit-code change, and skips the extra helm list I/O entirely. - Log why a non-deployed unchanged release is treated as changed, so an "UPDATED" release with no diff output is no longer unexplained. - Make ReleaseError.Error() nil-safe: the synthetic changed-release errors carry a nil err and would panic if ever formatted. - Escape the chart name in the getDeployedVersion regex with regexp.QuoteMeta. - Revert plain-diff integration goldens accordingly (apply goldens keep the new "Listing releases matching ..." line); cover the plain-diff no-change case in unit tests; extend CHANGELOG. Signed-off-by: yxxhero <[email protected]>
Second review pass on 53ee70c: - Precise the comment on the gated isDeployed probe: flag-specific lookups (--skip-diff-on-install and friends) still run helm list for plain diffs, as they predate this change. - ReleaseError.Error() now also guards against a nil ReleaseSpec and no longer claims a synthetic exit code 2 ("changed") is a failure. - The plain-diff unit test now fails on ANY unexpected helm list call (empty stub map + FailOnUnexpectedList), pinning down that a plain diff performs no deployed-state probe at all. Verified callers of the gating: apply (always true), diff (--detailed-exitcode flag), sync (uses diff only for the interactive confirmation prompt and discards the changed set - sync upgrades unconditionally), destroy (no diff). Signed-off-by: yxxhero <[email protected]>
25d5614 to
4933fe9
Compare
- CHANGELOG: note that HELMFILE_USE_HELM_STATUS_TO_CHECK_RELEASE_EXISTENCE keeps the previous skip-on-no-change behavior (helm status cannot distinguish release states) - helmexec: List() now warns when `helm list` returns more than one entry for a filter, instead of silently using the first; covered by a new table-driven unit test (parse, empty output, multi-entry warn) - state: quote the release name in the `helm list --filter` regex so names containing regex metacharacters (e.g. ".") match exactly - state: document that diffPrepareResult.deployed is only populated under detailedExitCode Signed-off-by: yxxhero <[email protected]>
1650a5f to
c3750ed
Compare
Currently, if any helm release is extant in the cluster at all, "helmfile apply" will attempt to run a "helm diff" between the release in the cluster and the proposed release, and only run helm upgrade if the diff shows a change.
While this is a sensible check for "deployed" releases, for failed (and possibly any other) release states, if the diff hasn't changed (even though the release never succeded), it results in the worst possible outcome: helmfile appears to finish successfully, while completely ignoring the failed release.
This ensures we always trigger an upgrade on releases that are in a non-deployed state. This way, if re-running with the same chart would succeed, we have the opportunity to fix things on rerun (let's say a helm hook pre or post-upgrade job will succeed now due to fixing a service external to the chart); if it wouldn't, by rerunning the upgrade, we will again see the error rather than it going under the radar and giving the false impression that everything is hunky dory.