Skip to content
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

Generated zip files always have new timestamps and force stack updates #186

Closed
troyready opened this issue Sep 17, 2021 · 5 comments · Fixed by #187
Closed

Generated zip files always have new timestamps and force stack updates #186

troyready opened this issue Sep 17, 2021 · 5 comments · Fixed by #187
Labels

Comments

@troyready
Copy link
Contributor

Every invocation of bestzip generates a zip file with a different sha256 hash because of the contents' timestamps. Similar issue exists for serverless-webpack as well.

When Serverless is creating zips, it avoids this by explicitly setting the files' timestamps to the epoch. Bestzip could copy this for platforms without a zip executable, but it would require a different approach for when it shells out to zip (which doesn't have a flag to override timestamps).

@troyready
Copy link
Contributor Author

Some solutions that come to mind:

  • Switch to a deterministic zip provider
    • serverless-webpack is likely going back to archiver
  • Modify the files' timestamps before zipping them
    • Something like the javascript equivalent of find . -exec touch -t 197001010000 {} +

I'm partial to switching to archiver, but curious for your thoughts/preference.

@olup
Copy link
Contributor

olup commented Sep 17, 2021

Very interesting. I'd second going back to archiver, as I am no fan of bestzip.

However, as this was an improvement for some heavy duty use cases, it might be a good idea to follow the (still unmerged it seems) PR of serverless webpack, and add a nativeZip option to let user opt-in best zip.

@floydspace
Copy link
Owner

Hey, @olup, I can't remember exactly what benefit we got from migrating to bestzip? are those improvements worth the issues we have currently? I'd also vote for reverting back to archiver.
This week I went through the zip-it-and-ship-it by Netlify, they also are using archiver.

@olup
Copy link
Contributor

olup commented Sep 17, 2021

The original issue should be here somewhere. Someone argued, with benchmarks, that it made a huge performance difference when zipping many many functions. My concerns with bestzip were low maintenance and no typings.

floydspace pushed a commit that referenced this issue Sep 18, 2021
bestzip preserves file timestamps, which causes function zips to be
different after every esbuild.

Because there are scenarios where native js zipping is unacceptably
slower than native system zip, the option to use it is preserved as an
option.

Fixes: #186
@github-actions
Copy link

🎉 This issue has been resolved in version 1.18.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants