-
Notifications
You must be signed in to change notification settings - Fork 292
Add support for custom output formats #221
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
Conversation
Signed-off-by: Sergio Morales <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@semoac Hey! Thank you so much for this awesome work
This LGTM overall. But can I later make json
output format as an alias to the current template
output? I think that's more straightforward for users wanting to use json output.
Probably we can easily add yaml
output on top of that, but that's another story!
@semoac Also - would you mind if we reused your screencaptures in our README? |
Sure. Go ahead! |
This adds the JSON output on top of #221, which can be enabled by passing `--output json`. Internally it works exactly the same as the `template` output format with the default template. ``` ******************** Release was not present in Helm. Diff will show entire contents as new. ******************** [{ "api": "v1", "kind": "Secret", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" },{ "api": "v1", "kind": "ConfigMap", "namespace": "default", "name": "mysql-1567775891-test", "change": "ADD" },{ "api": "v1", "kind": "PersistentVolumeClaim", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" },{ "api": "v1", "kind": "Service", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" },{ "api": "apps", "kind": "Deployment", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" }] ``` Ref #221 (review)
This adds the JSON output on top of #221, which can be enabled by passing `--output json`. Internally it works exactly the same as the `template` output format with the default template. ``` ******************** Release was not present in Helm. Diff will show entire contents as new. ******************** [{ "api": "v1", "kind": "Secret", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" },{ "api": "v1", "kind": "ConfigMap", "namespace": "default", "name": "mysql-1567775891-test", "change": "ADD" },{ "api": "v1", "kind": "PersistentVolumeClaim", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" },{ "api": "v1", "kind": "Service", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" },{ "api": "apps", "kind": "Deployment", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" }] ``` Ref #221 (review)
This adds the JSON output on top of #221, which can be enabled by passing `--output json`. Internally it works exactly the same as the `template` output format with the default template. ``` ******************** Release was not present in Helm. Diff will show entire contents as new. ******************** [{ "api": "v1", "kind": "Secret", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" },{ "api": "v1", "kind": "ConfigMap", "namespace": "default", "name": "mysql-1567775891-test", "change": "ADD" },{ "api": "v1", "kind": "PersistentVolumeClaim", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" },{ "api": "v1", "kind": "Service", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" },{ "api": "apps", "kind": "Deployment", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" }] ``` Ref #221 (review)
This adds the JSON output on top of #221, which can be enabled by passing `--output json`. Internally it works exactly the same as the `template` output format with the default template. ``` ******************** Release was not present in Helm. Diff will show entire contents as new. ******************** [{ "api": "v1", "kind": "Secret", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" },{ "api": "v1", "kind": "ConfigMap", "namespace": "default", "name": "mysql-1567775891-test", "change": "ADD" },{ "api": "v1", "kind": "PersistentVolumeClaim", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" },{ "api": "v1", "kind": "Service", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" },{ "api": "apps", "kind": "Deployment", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" }] ``` Ref #221 (review)
This adds the JSON output on top of #221, which can be enabled by passing `--output json`. Internally it works exactly the same as the `template` output format with the default template. ``` ******************** Release was not present in Helm. Diff will show entire contents as new. ******************** [{ "api": "v1", "kind": "Secret", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" },{ "api": "v1", "kind": "ConfigMap", "namespace": "default", "name": "mysql-1567775891-test", "change": "ADD" },{ "api": "v1", "kind": "PersistentVolumeClaim", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" },{ "api": "v1", "kind": "Service", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" },{ "api": "apps", "kind": "Deployment", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" }] ``` Ref #221 (review)
This adds the JSON output on top of #221, which can be enabled by passing `--output json`. Internally it works exactly the same as the `template` output format with the default template. ``` ******************** Release was not present in Helm. Diff will show entire contents as new. ******************** [{ "api": "v1", "kind": "Secret", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" },{ "api": "v1", "kind": "ConfigMap", "namespace": "default", "name": "mysql-1567775891-test", "change": "ADD" },{ "api": "v1", "kind": "PersistentVolumeClaim", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" },{ "api": "v1", "kind": "Service", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" },{ "api": "apps", "kind": "Deployment", "namespace": "default", "name": "mysql-1567775891", "change": "ADD" }] ``` Ref #221 (review)
Hi!
I was using these changes to format the output of helm-diff and I think it may be useful to someone else.
I use these formats to help me make decisions during my CI/CD pipeline on whatever or not the changes should be applied unsupervised. They also help me reduce the visual noise when
helmfile
has to process a lot of releases.I also been using the "template" output format to feed data to external system that needs to know what resource could be affected on upgrades.
This PR do not fix anything. I'm just sharing code. Please feel free to reject it without explanation.
Examples
Simple with helmfile
Template with a json like output