-
Notifications
You must be signed in to change notification settings - Fork 66
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
feat: Rename detection for Kubernetes resources #409
base: main
Are you sure you want to change the base?
Conversation
@HeavyWombat Hello! Sorry to bother, but since you appear to be the main maintainer of this repository. I know the change is a bit large, so I'll be happy to explain the changes if anything is unclear. I'm already making heavy use of this feature in GitOps repositories at my hobby project and also at my company. |
@HeavyWombat Hi, any updates? 👀 |
Thanks for asking and thank you for your patience and understanding. I am trying to use as much time as I can in my PTO to work on my Homeport projects. |
Thanks for the PR and your patience. I took the liberty to rebase and update the feature branch so that the tests pass again. I still need some time to digest all the proposed changes here. And I need to dig into the license question a bit, because this would be the first time for the project to copy/incorporate foreign code into the project. So far, everything in |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #409 +/- ##
==========================================
+ Coverage 80.97% 81.11% +0.14%
==========================================
Files 15 16 +1
Lines 2092 2187 +95
==========================================
+ Hits 1694 1774 +80
- Misses 326 333 +7
- Partials 72 80 +8
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Hello!
This pull request adds git-like rename detection logic for Kubernetes documents comparison.
For now, I have implemented this only for Kubernetes resources, whose name "keys" can be computed from
metadata.name
and other fields.This is because additions and deletions can be computed only if these "keys" are present.
The heuristic rename detection logic was mostly taken from https://github.com/go-git/go-git.
I would love to use this feature in my use-case, that is, using configMapGenerator with kustomize.
Currently, changing file contents a little bit results in a huge diff, because the kustomize adds hash suffix to resource names.
This use-case is added as a test case under
./assets/kubernetes/rename
directory.Example of real-life use-case: traPtitech/manifest#600 (comment)
The implementation may still be rough-cut, so please feel free to correct or point out anything you don't like.
I've prepared a (pre-)release in my forked repository so you can install it and try it out with the following one-line script.
https://github.com/motoki317/dyff/releases
curl --silent --location https://git.io/JYfAY | ORG=motoki317 REPO=dyff bash
Thank you in advance!
resolves #359