helmfile icon indicating copy to clipboard operation
helmfile copied to clipboard

Weird diff behaviour with line endings

Open 4c74356b41 opened this issue 4 years ago • 9 comments

I constantly see these changes in helmfile diff:

- apiVersion: v1
- kind: Namespace
- metadata:
-   name: istio-system
-   labels:
-     sidecar.istio.io/inject: "false"
+ apiVersion: v1
+ kind: Namespace
+ metadata:
+   name: istio-system
+   labels:
+     sidecar.istio.io/inject: "false"
      istio-injection: disabled << this last line is always okay across all files

these only happen when I run helmfile apply in the pipeline after running it locally (or vice versa). all of the files located in the repo display this behaviour. all the external charts - dont.

I'm using the same container locally and in the pipeline ( 4c74356b41/helmfile:azure ). LF is enforced on files everywhere. this might be related to https://github.com/databus23/helm-diff/issues/144 (it is not released yet I built it locally, but I observe the same behaviour).

Any ideas\pointers?

4c74356b41 avatar Jul 19 '21 08:07 4c74356b41

Same here, very annoying...

UsovVladimir avatar Jul 21 '21 13:07 UsovVladimir

Same thing, please help ❤️‍🩹

vladimirglazkov avatar Jul 21 '21 15:07 vladimirglazkov

I dream that someone will finally fix it

AleksandrNew avatar Jul 21 '21 17:07 AleksandrNew

Since the diff plugin added an option to ignore the line endings (--strip-trailing-cr ), is there something that blocks an implementation/adaptation for helmfile?

nerumo avatar Oct 08 '21 13:10 nerumo

@nerumo I tried looking at helmfile code, but its a bit over my head (never worked with Go), so I'm not sure how easy it is to implement it? I think its not possible to pass arguments to the plugin, only to helm? ie when I do:

helmfile apply --strip-trailing-cr

it complains - its not found

4c74356b41 avatar Oct 08 '21 13:10 4c74356b41

okay, i think you can do this:

helmfile diff --args='--strip-trainling-cr'

but it still reports every resource as changed, but doesn't show any diff, ie like so:

default, istio-system, Namespace (v1) has changed:
  # Source: cluster-base/templates/01-namespaces.yaml
  apiVersion: v1
  kind: Namespace
  metadata:
    name: istio-system
    labels:
      sidecar.istio.io/inject: "false"
      istio-injection: disabled

no red or green, no + or - (both using helmfile diff and helm diff xxx)

4c74356b41 avatar Oct 08 '21 14:10 4c74356b41

it works now with the latest version:

helmfile diff --args='--strip-trailing-cr'

think we can close it now

nerumo avatar Mar 09 '22 09:03 nerumo

This doen't work in all cases, I believe it fails when using local helm charts in a different directory, as for me it crashes when trying to execute helm dependency build <pathToChart> --strip-trailing-cr.

FWest98 avatar Jun 01 '22 01:06 FWest98

We've moved to https://github.com/helmfile/helmfile. It would be great if you could submit a pull request there to add helmfile diff --strip-trailing-cr!

mumoshu avatar Jun 01 '22 02:06 mumoshu