-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix bug where dirty submodules broke hash generation #711
Fix bug where dirty submodules broke hash generation #711
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
8517821
to
35375dc
Compare
Whoops, totally missed that there are tests that need fixing now. Along those lines, this approach needs some tweaking if it's going to have reproducible results. This is because the default
We should really only hash the diff content itself. That still might be a problem for
Before I go off and change the diff command and fix the tests (for non-submodules at least), what do people think of this approach in general given these considerations? |
This makes sense overall to me. Will you be able to sign the CLA? |
@dlorenc yup, sorry - I started getting that sorted out but now I'm traveling for a few days. I'll have the CLA signed and the tests fixed by Monday. Thanks! |
35375dc
to
2a86e0c
Compare
CLAs look good, thanks! |
2a86e0c
to
cd11ef6
Compare
Instead of appending the entire contents of modified files to the sha256 input, we should only append the diff as computed by `git diff` in order to handle all modifications properly, including submodules. Signed-off-by: Matt Kelly <matt.kelly@containership.io>
cd11ef6
to
f06a691
Compare
Fixed tests and rebased / fixed conflicts to incorporate b8cfc37#diff-7b47f8007b648de24c6b5c948a869dd6R171 properly. Two notes:
|
Thanks @mattkelly I'm going to merge your fix. However, in #714, I stop computing a sha256 of file changes because of the reasons you mention. Instead I use the imageID when the repo is dirty. |
This is a proposal for a fix for #685. Please let me know what you think of the approach! I'm new to the Skaffold code, so hopefully I'm not misunderstanding how this should work.
Regarding splitting the status lines:
??
isn't the only special case (two characters).MM
is also a valid status, for example. If my understanding of the purpose of that code was correct, then my new implementation should be more robust. Ideally I would have split this out as a separate commit, but it's pretty tangled in there.Instead of appending the entire contents of modified files to the sha256
input, we should only append the diff as computed by
git diff
in orderto handle all modifications properly, including submodules.
This also fixes a bug where the processing of the git status output was
too fragile. It makes it more generic by splitting the status string on
fields instead.
Signed-off-by: Matt Kelly matt.kelly@containership.io