Conversation
1248c29 to
4ccbd50
Compare
|
There is alternative implementation in #1798, but I believe it has several issues. |
| DockerManifestSchema2 MediaType = "application/vnd.docker.distribution.manifest.v2+json" | ||
| DockerManifestList MediaType = "application/vnd.docker.distribution.manifest.list.v2+json" | ||
| DockerLayer MediaType = "application/vnd.docker.image.rootfs.diff.tar.gzip" | ||
| DockerLayerZstd MediaType = "application/vnd.docker.image.rootfs.diff.tar.zstd" |
There was a problem hiding this comment.
Yes, to my surprise, such thing exists. See moby/buildkit#2344 (comment), moby/buildkit#3968 and containerd/containerd#9263.
49b2380 to
2161e22
Compare
It is now possible to `crane append -f bla.tar.zstd` to upload Zstd layer, both from file and from pipe. Before this commit, crane would erroneously upload such layer with gzip mime type. While this PR does not _fully_ solve google#1501, it is very close to that. Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
2161e22 to
90eea67
Compare
| var compressor io.WriteCloser | ||
|
|
||
| if comp == compression.ZStd { | ||
| compressor, _ = zstd.NewWriter(out) |
There was a problem hiding this comment.
This test was very broken, because it didn't actually test zstd at all.
|
@imjasonh is there anything else left here before it can be merged? |
|
@slonopotamus in testing with this PR I've noticed that the ErrNoProgress happens when the This can be worked around by creating a custom peek reader as I've done here, but obviously at the cost of added complexity. |
|
If I understand you properly, you want to say that I am actually not sure... Why |
It's part of a silly implementation in the In the event that your reader source would return 0 bytes & no error (which is perfectly acceptable), it will throw. My use-case is that our ZStd library is using CGO bindings as it's more efficient than the go-native ZStd implementations. So before it was acceptable to return 0 bytes and no error, but with this change it would break even non-zstd builds potentially. Edit: here's the library we use https://github.com/DataDog/zstd |
|
I am confused. Who is "we"? Current package uses Also, bufio would error out if it gets a hundred of zero-length reads in a row: https://github.com/golang/go/blob/go1.22.0/src/bufio/bufio.go#L42 You want to say you know underlying reader library that does that? But why? Such library doesn't follow
We surely can Ctrl+C/Ctrl+V I've asked what Go devs think about current |
|
Go devs say golang/go#27531 (comment):
|
|
Friendly ping @imjasonh @jonjohnsonjr is there anything we can do this get this reviewed for @slonopotamus? I.e bazel-contrib/rules_oci#333 and bazel-contrib/rules_oci#523 |
|
|
||
| // NewLayer creates a Layer from an io.ReadCloser. | ||
| func NewLayer(rc io.ReadCloser, opts ...LayerOption) *Layer { | ||
| func NewLayer(rc io.ReadCloser, opts ...LayerOption) (*Layer, error) { |
There was a problem hiding this comment.
I'd like to avoid this breaking API change if we can.
We could add an err field to the Layer struct and return it on the first access to any of methods. (I don't love it, but I also don't want to break stuff.)
There was a problem hiding this comment.
This is so weird... :D When later someone adds a method to Layer, they will definitely forget about this hack and introduce a bug. And what do we do if Layer has a method that doesn't return error?
There was a problem hiding this comment.
So. Do you really want me to do this and this is the only thing preventing this PR from being merged?
There was a problem hiding this comment.
@jonjohnsonjr if I pop open a new PR with the requested changes can I get buy-in that we'll try and get this feature added?
| DockerManifestSchema2 MediaType = "application/vnd.docker.distribution.manifest.v2+json" | ||
| DockerManifestList MediaType = "application/vnd.docker.distribution.manifest.list.v2+json" | ||
| DockerLayer MediaType = "application/vnd.docker.image.rootfs.diff.tar.gzip" | ||
| DockerLayerZstd MediaType = "application/vnd.docker.image.rootfs.diff.tar.zstd" |
|
This Pull Request is stale because it has been open for 90 days with |
|
This Pull Request is stale because it has been open for 90 days with |
It is now possible to
crane append -f bla.tar.zstdto upload Zstd layer, both from file and from pipe.Before this commit, crane would erroneously upload such layer with gzip mime type.
This PR does not fully solve #1501 because I don't add commandline switch to allow recompression.