-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normalize YAML manifests before running diff #273
Conversation
Hi @databus23 any chance we could get this PR and #268 in a new plugin release? |
👍 this would be fantastic, greatly decrease signal to noise ratio when comparing diffs |
@mumoshu Any chance you could take a look at this and possibly create a new plugin release? |
Hello, big sorry for being late to the party. I just haven't found the time recently to work on this project. I have some concerns about this PR.
|
|
@databus23 Thank you for taking a look at this! |
Looks like @scott-grimes beat me to the punch with the same suggestion 😆 |
Hi @databus23 any chance we can have this merged and a new cut of |
I still have concerns. I get the stated point about occasional noisy diffs when something is refactored but that's not the majority of diffs I'm experencing daily in CI pipelines. Most of the times the diffs are a couple of lines small. In those cases having everything reordered and not looking like the original template seems confusing to me. I guess it all depends on the actual charts that are used and how frequent substantial changes to the chart are committed. I would much prefer this to be an option and not change the output by default. |
The current behavior of helm-diff is to show diffs even when the YAML files are semantically identical but they contain style differences, such as indentation or key ordering. As an example, the following two YAMLs would be showing diffs: ``` apiVersion: v1 kind: Service metadata: name: app-name labels: app.kubernetes.io/name: app-name app.kubernetes.io/managed-by: Helm spec: ports: - name: http port: 80 targetPort: http selector: app.kubernetes.io/name: app-name type: ClusterIP ``` ``` apiVersion: v1 kind: Service metadata: labels: app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: app-name name: app-name spec: ports: - name: http port: 80 targetPort: http selector: app.kubernetes.io/name: app-name type: ClusterIP ``` even though they are semantically the same. This commit exploits the reordering and normalization that is performed by the yaml package when marshaling by unmarshaling and re-marshaling all manifests before running the diff, thus eliminating the issue.
cbb60e1
to
3ce490e
Compare
@databus23 I pushed another commit making the normalization behavior configurable with the |
Thanks! |
thanks! with this change all issues I was aware of fixed for me, I think it worst to have new release with it :) |
The current behavior of helm-diff is to show diffs even when the YAML files are semantically identical but they contain style
differences, such as indentation or key ordering.
As an example, the following two YAMLs
would be showing the following diffs
even though they are semantically the same.
This commit exploits the reordering and normalization that is performed by the yaml package when marshaling, by unmarshaling and re-marshaling all manifests before running the diff, thus eliminating the issue.
This PR should address and fix #257.