feat: add --kube-context flag support by yxxhero · Pull Request #924 · databus23/helm-diff

@yxxhero

Add native --kube-context flag to all helm-diff commands (upgrade, revision,
rollback, release) to allow users to specify kubeconfig context directly
instead of relying on HELM_KUBECONTEXT environment variable workaround.

Fixes #603

Signed-off-by: yxxhero <aiopsclub@163.com>
Add tests to verify that --kube-context flag is properly passed to
helm commands, addressing review comments from PR #924:

- Test basic --kube-context flag propagation to helm commands
- Test --kube-context with --reuse-values flag
- Test that --namespace is also passed when using --kube-context
- Add wildcard argument matching for dynamic temp file paths

Signed-off-by: yxxhero <aiopsclub@163.com>
…commands

Signed-off-by: yxxhero <aiopsclub@163.com>

@yxxhero

- Use local copy of envSettings in actionConfig.Init to avoid mutating
  shared state and prevent data races
- Fix test stub flag order to match production code (--namespace before
  --kube-context)
- Extract helmDiffTestHelper to reduce duplicated test setup code

Signed-off-by: yxxhero <aiopsclub@163.com>

@yxxhero yxxhero deleted the feat/kube-context-flag branch

February 28, 2026 00:18