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

exporter: support creating blobs with zstd compression #2344

Merged
merged 2 commits into from
Sep 7, 2021

Conversation

tonistiigi
Copy link
Member

@ktock @fuweid

Signed-off-by: Tonis Tiigi tonistiigi@gmail.com

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Copy link
Collaborator

@ktock ktock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TestGetRemote in manager_test.go needs to be updated to also create zstd.

// UnknownCompression means not supported yet.
UnknownCompression Type = -1
)

const (
mediaTypeDockerSchema2LayerZstd = images.MediaTypeDockerSchema2Layer + ".zstd"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to support application/vnd.docker.image.rootfs.diff.tar.zstd? Maybe we can forcibly turn on oci-mediatype=true when zstd.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC no application/vnd.docker.image.rootfs.diff.tar.zstd in https://github.com/distribution/distribution/blob/v2.7.1/docs/spec/manifest-v2-2.md#media-types ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can provide more compatibility with registries. Not hard to support it and impossible for the spec to define something incompatible.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to keep this OCI-only.

I guess non-OCI compliant registries are unlikely to support MediaTypeDockerSchema2Layer + ".zstd" too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docker hub seems to support the docker mediatypes without any changes. I would guess at least Moby should always support them as well (after general zstd update).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw, zstd is not part of any standard atm. Even OCI has never released it. I guess if distribution/distribution would ever add this mediatype (I'm not sure if they are interested in maintaining this part) it wouldn't be before docker engine actually supports it.

Estargz support has been removed from this test as
implementation does not guarantee digest stability
and only reason it passed were the exceptions in the
test via variant map that ignored cases where timing
resulted the digest to go wrong. This needs to be
addressed in the follow up if we want to keep estargz
support.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@tonistiigi
Copy link
Member Author

TestGetRemote in manager_test.go needs to be updated to also create zstd.

I updated the test but found a very problematic issue. I never realized that estagz messes up the uncompressed digest for a reference. That is a huge problem as these digests are meant to be stable for the ref and image. TestGetRemote is supposed to check the digest stability and the only reason it passed was because there were a bunch of exceptions where if a timing caused a digest to change it just ignored the error and replaced the expected value from an internal array. I removed all the estargz parts from that test atm because it doesn't work and it is pointless to add more exceptions for new combinations where this can go wrong. We can discuss in a separate issue but I don't think we can ever support lossy compressions. If we want to keep estargz I think there at least needs to be a custom lossless decompress method. Even if that means that diffid and image config still changes at least we can use it for blob conversion. There can't be a case where build returns completely different images(with different diffid) because of the order of how a previous build (possibly build for different project) chose compressions.

Copy link
Collaborator

@ktock ktock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for pointing the issue. I'll work on estargz decompressor that provides the original tar contents.

zstd changes LGTM.

Copy link
Contributor

@fuweid fuweid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM(nb)

@@ -1160,7 +1166,7 @@ func TestGetRemote(t *testing.T) {
eg, egctx := errgroup.WithContext(ctx)
for _, ir := range refs {
ir := ir.(*immutableRef)
for _, compressionType := range []compression.Type{compression.Uncompressed, compression.Gzip, compression.EStargz} {
for _, compressionType := range []compression.Type{compression.Uncompressed, compression.Gzip /*compression.EStargz,*/, compression.Zstd} {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is EStargz intentionally omitted here? Could you add a comment line if so?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, see #2344 (comment) and the commit message. Also have "disabled" message in code (not on that line). In current form, it is a release blocker for v0.10 for me.

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

Successfully merging this pull request may close these issues.

5 participants