-
Notifications
You must be signed in to change notification settings - Fork 18.9k
WIP: pkg/archive: move compression to a separate package #49167
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
Conversation
These can still be supported with containerd, they just need to be registered |
|
Ah, right; yes, I was also looking if we should split out parts to make them more modular "register compression X" |
| // DecompressStream decompresses the archive and returns a ReaderCloser with the decompressed archive. | ||
| // | ||
| // Deprecated: use [compression.DecompressStream]. | ||
| func DecompressStream(archive io.Reader) (io.ReadCloser, error) { |
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.
Oh! Right, linter won't be happy yet, because I did not yet update code calling these moved functions;
internal/testutils/archive.go:12:13: SA1019: archive.DecompressStream is deprecated: use [compression.DecompressStream]. (staticcheck)
rd, err := archive.DecompressStream(compressedTar)
^
| type Compression int | ||
|
|
||
| const ( | ||
| Uncompressed Compression = 0 // Uncompressed represents the uncompressed. |
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.
How about compression.None instead of compression.Uncompressed?
| Uncompressed Compression = 0 // Uncompressed represents the uncompressed. | |
| None Compression = 0 // None represents the uncompressed. |
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.
Ah, yes, that works for me; nice and short.
TODO: align with containerd pkg/archive/compression, which - also moved the utilities to Compress/Decompress streams - changed the Extension to not include ".tar" Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2ac6069 to
36e5b96
Compare
It's only used in tests now, so move it there, and simplify, removing the atomic bool and logs. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
36e5b96 to
124b466
Compare
|
Hmm.. failure could be related; need to check what changed for that test |
|
This is really (really!) WIP; something I was considering if this would make sense to do; fun fact; when I started doing this, I noticed that containerd's fork of
pkg/archivedid exactly the same, so doing this would align our implementation more with containerd's approach; https://github.com/containerd/containerd/tree/v2.0.1/pkg/archive/compressioncontainerd has some minor differences in the
Compressiontype;Compression.Extension()only returns file extension for the compression (e.g..gzip) instead of also including.tar; https://github.com/containerd/containerd/blob/v2.0.1/pkg/archive/compression/compression.go#L256-L266readCloserWrapper, and povides aGetCompression()accessor for this https://github.com/containerd/containerd/blob/v2.0.1/pkg/archive/compression/compression.go#L88-L90igzip(in addition topigz); Use Intel ISA-L's igzip if available containerd/containerd#9200In reverse, Moby;
Xz,Bzip2), which are not supported in containers)closedfield forreadCloserWrappermoby/pkg/archive/archive.go
Lines 221 to 233 in a72026a
I'm not sure if we actually need that one though, as it was added to work around an OTEL issue, and not sure if we actually hit that codepath in this code; 585d74b (#46419)
- What I did
- How I did it
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)