-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
Add support for zstd compressed archives #36754
Conversation
55454d7
to
98963c6
Compare
98963c6
to
93d2cbb
Compare
0193ef6
to
4846244
Compare
Codecov Report
@@ Coverage Diff @@
## master #36754 +/- ##
==========================================
+ Coverage 34.93% 34.94% +0.01%
==========================================
Files 614 614
Lines 45645 45665 +20
==========================================
+ Hits 15944 15959 +15
- Misses 27607 27611 +4
- Partials 2094 2095 +1 |
c43b856
to
2ba540c
Compare
What's the goal here? This will allow the archive package to decompress these streams, but who is pushing them and what is the impact there? This effectively creates a new layer format and we'd need a new mediatype to represent that. |
@stevvooe the goal of this PR is to make it possible to use enable
Without this PR, the container will just include a foo.tar.zst. With the PR the tarball will be unpacked. See the latest release for some benchmarks and advantages of zstd against others: If this adds more than I thought it would, please let me know what needs to be changed to get this functionality into it. |
pkg/archive/archive_test.go
Outdated
@@ -153,9 +160,22 @@ func TestCompressStreamBzip2Unsupported(t *testing.T) { | |||
} | |||
defer dest.Close() | |||
|
|||
_, err = CompressStream(dest, Xz) | |||
_, err = CompressStream(dest, Bzip2) |
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.
Is this change necessary for this PR?
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.
Not necessary for this PR, but a drive-by change since I was adding more tests. I can add it in to a separate PR if that's preferred.
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.
Please do. CC me and we can get that clean up merged!
Because of the way we implement layer decompression, this may allow for use of zstd in the image format. If the purpose here is build, then I see no problem with introducing this. cc @tonistiigi |
Signed-off-by: Manuel Rüger <[email protected]>
2ba540c
to
71c8d37
Compare
My purpose is build-only. Although I guess it might be worth considering it in the future for the image format as well. I split the unrelated changes into a separate PR. |
I'm not really in favour of this; This would only benefit adding a local archive, only to decompress it after adding to the image; could you explain the use-case a bit more? i.e. why keep a compressed archive, but using the content of the archive in the image (instead of having the files uncompressed in the build context?) |
In general I'd expect zstd becoming a somewhat more common format in the next couple of years, it's just a catch22 to provide support for it first vs. its consumers. Tar added support recently: http://git.savannah.gnu.org/cgit/tar.git/commit/?id=3d45373d3b192d7342d49524193497598818d36d The system I use to creates zstd-compressed tarballs (and xz or gz, but zstd has a time/size sweetspot the others don't have), which I use to bootstrap a base container with.
|
Discussing this with other maintainers, and at this point we don't think we should add this feature. I did also discuss this with @tonistiigi, and after we fully integrate buildkit (https://github.com/moby/buildkit), adding support for custom archive formats would be possible by using a different/custom front end. For reasons above, I'm closing this PR, but thanks for contributing, and feel free to continue the conversation 👍 |
- What I did
Added support for zstd compression (https://github.com/facebook/zstd) Issue: #28394
- How I did it
Added it to archive, which hopefully should be enough to support it. This will add a requirement on zstd to be installed on your system.
- How to verify it
touch foo; tar -c -I zstd -f foo.tar.zst foo
ADD foo.zst .
- Description for the changelog
Add support for zstd compressed archives