helmfile/test/integration
Aditya Menon c4a828686e
fix: pass --kube-context to helm template when using jsonPatches (#2363)
fix: pass --kube-context to helm template when using jsonPatches (#2309)

When using jsonPatches or strategicMergePatches in helmfile, the
`helm template` command was not receiving the `--kube-context` flag.
This caused issues when `--dry-run=server` was used (introduced in
PR #2271 to support lookup() functions), because helm would connect
to the wrong cluster context.

Root Cause:
1. `flagsForTemplate()` did not call `appendConnectionFlags()`, unlike
   `flagsForUpgrade()` and `flagsForDiff()` which both include this call.
2. `processChartification()` did not include `--kube-context` when
   setting `chartifyOpts.TemplateArgs` for internal helm template calls.

Fix:
1. Added `appendConnectionFlags()` call to `flagsForTemplate()` to ensure
   kube-context and other connection flags are passed to helm template.
2. Added `getKubeContext()` helper function that resolves kube-context
   with proper priority: release > environment > helmDefaults.
3. Modified `processChartification()` to include `--kube-context` in
   chartifyOpts.TemplateArgs when chartify needs to run helm template.
4. Added compatibility check for `--validate` flag to avoid Helm 4
   mutual exclusion error between --validate and --dry-run (Issue #2355).

Fixes #2309

Signed-off-by: Aditya Menon <amenon@canarytechnologies.com>
2026-01-16 20:32:33 +08:00
..
.gnupg Add helm-secrets-encrypted values template file (#1701) 2021-04-06 14:20:42 +09:00
charts add post render integration test (#576) 2022-12-14 11:38:47 +08:00
lib fix(integration-tests): read correct minikube status (#1768) (#1769) 2024-11-05 22:24:36 +08:00
test-cases fix: pass --kube-context to helm template when using jsonPatches (#2363) 2026-01-16 20:32:33 +08:00
run.sh fix: pass --kube-context to helm template when using jsonPatches (#2363) 2026-01-16 20:32:33 +08:00