-
Notifications
You must be signed in to change notification settings - Fork 21
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
[Feature Request] Added ability to generate structed diffs #69
Comments
Hi @ponkio-o, Thank you for the suggestion! I completely understand where you're coming from. I actually already tried this 🚀 There's a branch [link] where I use the However, the feedback I received was that this style ⬇️ : @@ metadata.name @@
# apps/v1/Deployment/default/super-app-name
! ± value change
- super-app-name
+ new-app-name
@@ spec.replicas @@
# apps/v1/Deployment/default/super-app-name
! ± value change
- 1
+ 5
@@ spec.template.spec.serviceAccountName @@
# apps/v1/Deployment/default/super-app-name
! ± value change
- super-app-name
+ new-app-name was much harder to read than this style ⬇️ : diff --git base/my-app target/my-app
index eb9e290..7cf6187 100644
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/instance: my-app
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: myApp
app.kubernetes.io/version: 1.16.0
argocd.argoproj.io/instance: my-app
helm.sh/chart: myApp-0.1.0
- name: super-app-name
+ name: new-app-name
namespace: default
spec:
- replicas: 1
+ replicas: 5
selector:
matchLabels:
app.kubernetes.io/instance: my-app
app.kubernetes.io/name: myApp
template:
metadata:
labels:
app.kubernetes.io/instance: my-app
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: myApp
@@ -77,12 +77,12 @@ spec:
- containerPort: 80
name: http
protocol: TCP
readinessProbe:
httpGet:
path: /
port: http
resources: {}
securityContext: {}
securityContext: {}
- serviceAccountName: super-app-name
+ serviceAccountName: new-app-name This is mainly due to the lack of context around the change. If you still believe this adds value, I'll add it to my to-do list and include it as an option Let me know what you think! 🍀 |
Thank you for your response!
Ah, I see. So what about using $ dyff between A.yaml B.yaml --set-exit-code --ignore-order-changes
$ echo $?
0 If 1 is returned, run the ‘git diff’ command; if 0, do nothing. In this way, if the order is only swapped, it is determined that there is no difference. Also, although I have used the |
Hi @dag-andersen !
Thank you for developing a great tool!
Summary
I want the ability to generate structed diffs.
Background
Currently, argocd-diff-preview using the
git diff
command to generate diff between two branches.argocd-diff-preview/src/diff.rs
Line 59 in a31805d
Therefore, even if the actual structure has not changed, but only the order has been switched, it will be displayed as a difference.
A.yaml
B.yaml
Run
git diff --no-index A.yaml B.yaml
.Although they are different, they do not actually change the resources on Kubernetes, since the order of the arrays is only swapped.
Proposal
homeport/dyff is diff tool for YAML that can be generate the structed diff. Such a tool will ignore cases where the order of the listings has simply changed.
normal diff
structed diff (need
--ignore-order-changes
)$ dyff between --ignore-order-changes -o github A.yaml B.yaml
Of course, there are times when you want to check it as a difference, so it would be nice if it were offered as an option.
The text was updated successfully, but these errors were encountered: