helmfile: Missing colors in diff
After upgrading helm-diff to 3.2.0 or newer, running helmfile diff produces output with no colors when running in regular terminal (not CI, TERM=xterm-256color). In the same time running helm diff in the same terminal produces colors as expected.
My guess is that after https://github.com/databus23/helm-diff/pull/240, there is check https://github.com/databus23/helm-diff/blob/master/cmd/root.go#L47-L50 which always true due to how helmfile executes helm-diff. helm-diff’s stdout is captured/redirected in separate file descriptor which isn’t considered as terminal.
I tried passing running helmfile --no-color=false diff, but it didn’t enable color in diff output. Only way to enforce colors I found was helmfile diff --args="--no-color=false", but it’s problematic in way where this arg passed to helm list execution and fails there.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 7
- Comments: 23 (4 by maintainers)
Commits related to this issue
- feat: Auto-detect term for coloring helm-diff output Since helm-diff has added an ability to auto-detect the term to decide if it should output with color or not, helmfile had been defaulted to no-co... — committed to helmfile/helmfile by mumoshu 2 years ago
- feat: Auto-detect term for coloring helm-diff output Since helm-diff has added an ability to auto-detect the term to decide if it should output with color or not, helmfile had been defaulted to no-co... — committed to Sajfer/helmfile by mumoshu 2 years ago
Merged https://github.com/databus23/helm-diff/issues/344 on helm-diff. The next action item would be to enhance helmfile to set HELM_DIFF_COLOR appropriately.
@max-rocket-internet you need at least https://github.com/databus23/helm-diff/releases/tag/v3.4.0
I don’t see this.
Running
helmfile diffproduces output without colors.Running
helmfile --color diffproduces errorIncorrect Usage. flag provided but not defined: -colorand showshelmfileusage help.Running
helmfile diff --colorproduces errorIncorrect Usage. flag provided but not defined: -colorand showshelmfile diffusage help.Running
HELM_DIFF_COLOR=true helmfile diffproduces colored output.Is this expected resolution?
Additionally is it possible to make patch release of helmfile docker image, which includes updated helm-diff?
Fixed via https://github.com/helmfile/helmfile/pull/24
Turns out I forgot the fact that it only has
--no-colorbut--colorhttps://github.com/roboll/helmfile/blob/debd3c0eeac2cd40c8a1227a3d0424f5944c3b81/pkg/state/state.go#L1710-L1712That said,
HELM_DIFF_COLOR=true helmfile diffmight be the right way to force color! Thanks for pointing it out.As @frank-berlin has kindly shared, the latest helm-diff release should work well with
helmfile --color. Closing as resolved but please feel free to reopen if necessary. Thanks everyone for your cooperation!I agree, the colors are very useful in CI. I personally use them to reduce the output of diff to only changed lines (after creating the full diff). It used to work beautifully before.
See example output here (gitlab CI):
@mumoshu proposed logic look correct, just need to take into account
helmfile’s own--no-colorsargument.