-
Notifications
You must be signed in to change notification settings - Fork 199
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(archive.go): repeatable shasum on archive #1537
Conversation
Still trying to figure out why the archive shasum is still non-deterministic in the integration test on CI... thoughts @carolynvs ? Repeated runs locally pass... 🤔 |
Sorry been focused 100% on the infra migration from this week and haven't had time yet to consider this problem. I won't get a chance to look at this until Monday. |
9cf32dd
to
f79850c
Compare
Signed-off-by: Vaughn Dice <vadice@microsoft.com>
f79850c
to
2329baf
Compare
Signed-off-by: Vaughn Dice <vadice@microsoft.com>
2329baf
to
7d6fc63
Compare
The error reproduces on my machine! TO THE DEBUGGER! 💨 |
I am still looking into this. After your patch the diff between the files is MUCH closer but drifts towards the end of the file. |
I just pushed an extra commit that uses github.com/mholt/archiver to handle creating the file. Locally that fixed the problem for me. Let's see what happens on CI. A couple thoughts after I have worked on this:
|
Also I want to update the archive test to run archive twice and compare the hash. So that we don't get false positives on a dev machine. |
d319600
to
4a5a841
Compare
That probably explains why |
I'll give just plain .tar files a go too! |
573e464
to
c795fd7
Compare
Only check that the hash of the archive is repeatable. It will not be the same across operating systems. Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
c795fd7
to
eebf579
Compare
@vdice I checked docker save and also get different hashes on different computers. But on the same computer the hash is stable. I've updated the test to only check if the hash is the same between calls to porter archive, but doesn't assert that it matches some canonical hash (because there doesn't seem to be one). |
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.
LGTM. If we get more clever in the future, we can always revisit! 😀
What does this change
Uses the approach of zero-ing out the timestamps for all archive files to achieve this. As seen in https://unix.stackexchange.com/questions/346789/compressing-two-identical-folders-give-different-result and suggested by @sebumd in the original issue #1526
What issue does it fix
Closes #1526
Notes for the reviewer
Checklist
UnitIntegration TestsIf this is your first pull request, please add your name to the bottom of our Contributors list. Thank you for making Porter better! 🙇♀️