helmfile/pkg/helmexec
Copilot c57134cda7
Fix helmfile init failing to update outdated helm plugins with Helm v4 (#2554)
* Initial plan

* Fix helmfile init not updating outdated helm plugins with Helm v4

- UpdatePlugin now handles secrets plugin with Helm 4 by using the split
  plugin architecture (uninstall old + install via installHelmSecretsV4)
- UpdatePlugin falls back to uninstall + reinstall when helm plugin update
  fails (e.g., with Helm 4 or tarball-installed plugins)
- Fix string-based semver comparison for helm-secrets version check in
  both AddPlugin and UpdatePlugin using proper semver comparison
- Add helmSecretsRequiresSplitInstall helper for reuse and correctness
- Add tests for update failure fallback scenarios

Agent-Logs-Url: https://github.com/helmfile/helmfile/sessions/533f1b1c-dda6-4934-af27-051e4eaa9927

Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>

* Address reviewer feedback: preserve update error context and add version assertions in tests

- exec.go: include original update error in fallback log message; wrap both
  errors (update + reinstall) when reinstall also fails so callers get full context
- init_test.go: add semver import and GetPluginVersion assertions after
  CheckHelmPlugins to verify plugins are at required versions on disk

Agent-Logs-Url: https://github.com/helmfile/helmfile/sessions/c784db7d-7d4c-40a0-97f0-a31eb8901cd6

Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>

* Address second round of reviewer feedback

- exec.go: rename UpdatePlugin parameter path→repo for clarity
- exec.go: fix uninstallPlugin to only emit INFO log when err == nil
- exec_test.go: add Test_helmSecretsRequiresSplitInstall table-driven tests
  covering v4.6.9, v4.7.0, v4.8.0, v4.10.0, pre-release, invalid and empty
- exec_test.go: add Test_UpdatePlugin_Helm4SecretsUsesUninstallReinstall
  verifying that Helm 4 + secrets uses uninstall+reinstall (not plugin update)

Agent-Logs-Url: https://github.com/helmfile/helmfile/sessions/cbd3f8c9-ec7d-4500-b168-cb1c2f7c87bc

Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>

* Add len(args) >= 3 guards in test mock for plugin update/uninstall cases

Agent-Logs-Url: https://github.com/helmfile/helmfile/sessions/ea0f5afc-d52d-473b-b759-853a8f841a26

Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>

* Return early with combined error when uninstall fails in UpdatePlugin fallback

Agent-Logs-Url: https://github.com/helmfile/helmfile/sessions/bb9a675c-309d-4b06-83d4-a6fe078dce64

Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
2026-04-25 11:04:23 +08:00
..
testdata fix: support large output with --enable-live-ouput (#1139) 2023-11-12 06:45:08 +08:00
context.go Drop Helm v2 support (#613) 2023-01-17 09:24:47 +09:00
exec.go Fix helmfile init failing to update outdated helm plugins with Helm v4 (#2554) 2026-04-25 11:04:23 +08:00
exec_flag_filtering_test.go feat: add Helm 4 support while maintaining Helm 3 compatibility (#2262) 2025-11-19 07:49:30 +08:00
exec_test.go Fix helmfile init failing to update outdated helm plugins with Helm v4 (#2554) 2026-04-25 11:04:23 +08:00
exit_error.go Feat: add --strip-args-values-on-exit-error (#887) 2023-06-07 14:39:38 +08:00
exit_error_test.go Feat: add --strip-args-values-on-exit-error (#887) 2023-06-07 14:39:38 +08:00
helmexec.go feat: add `helmfile unittest` command for helm-unittest integration (#2400) 2026-02-16 09:45:10 +08:00
id.go Print command output in line (#1354) 2020-08-29 14:47:22 +09:00
id_test.go Add unittest for newExecutionID 2022-04-24 13:55:28 +08:00
log.go Fix snapshot tests to pass regardless of helm version (#572) 2022-12-10 10:54:03 +08:00
runner.go Fix panic when helm isn't installed (#2169) 2025-09-09 07:15:46 +08:00
runner_test.go fix: support large output with --enable-live-ouput (#1139) 2023-11-12 06:45:08 +08:00