Closed
Description
We use helm diff
like this:
HELM_DIFF_USE_UPGRADE_DRY_RUN=true helm diff upgrade "${DEPLOYMENT}" . --namespace "${NAMESPACE}" --values "values.yaml" --values "env.yaml" --values "values/foo/values.bar.yaml" --values "values/baz/values.bum.yaml" --allow-unreleased
This works fine IF the target namespace already contains a Helm deployment. However if there isn't one then this fails with
********************
Release was not present in Helm. Diff will show entire contents as new.
********************
panic: runtime error: slice bounds out of range [-1:]
goroutine 1 [running]:
github.com/databus23/helm-diff/v3/cmd.extractManifestFromHelmUpgradeDryRunOutput({0xc00062c400, 0x3e, 0x400}, 0x0)
github.com/databus23/helm-diff/v3/cmd/helm3.go:359 +0x3aa
github.com/databus23/helm-diff/v3/cmd.(*diffCmd).template.func3({0xc00062c400?, 0x4?, 0xc0001ec4b0?})
github.com/databus23/helm-diff/v3/cmd/helm3.go:263 +0x25
github.com/databus23/helm-diff/v3/cmd.(*diffCmd).template(0xc000003c00, 0x0)
github.com/databus23/helm-diff/v3/cmd/helm3.go:336 +0x1ad7
github.com/databus23/helm-diff/v3/cmd.(*diffCmd).runHelm3(0xc000003c00)
github.com/databus23/helm-diff/v3/cmd/upgrade.go:299 +0x30c
github.com/databus23/helm-diff/v3/cmd.newChartCommand.func2(0xc000146c08, {0xc0001482c0, 0x2, 0x224bc12?})
github.com/databus23/helm-diff/v3/cmd/upgrade.go:211 +0x379
github.com/spf13/cobra.(*Command).execute(0xc000146c08, {0xc000148210, 0xb, 0xb})
github.com/spf13/[email protected]/command.go:1015 +0xa94
github.com/spf13/cobra.(*Command).ExecuteC(0xc000146f08)
github.com/spf13/[email protected]/command.go:1148 +0x40c
github.com/spf13/cobra.(*Command).Execute(0x0?)
github.com/spf13/[email protected]/command.go:1071 +0x13
main.main()
github.com/databus23/helm-diff/v3/main.go:16 +0x18
Error: plugin "diff" exited with error
Removing the HELM_DIFF_USE_UPGRADE_DRY_RUN=true
makes this work.
We want to use HELM_DIFF_USE_UPGRADE_DRY_RUN=true
because without this environment variable set helm diff
can display bogus changes that don't actually happen.
Would be nice if this could be fixed. Thanks!
Software versions:
helm diff
runs in the container image from https://github.com/appuio/container-helm : ghcr.io/appuio/helm:latest- Versions can be found here: https://github.com/appuio/container-helm/blob/main/Dockerfile
- Last build was may 17 using Helm v3.17.3 and the then latest version of helm-diff