Skip to content
This repository was archived by the owner on Nov 19, 2026. It is now read-only.

image: fix docker v2s2 -> oci image config conversion - #232

Merged
runcom merged 1 commit into
containers:masterfrom
runcom:fix-oci-image-config
Jan 31, 2017
Merged

runcom merged 1 commit into
containers:masterfrom
runcom:fix-oci-image-config

Conversation

@runcom

@runcom runcom commented Jan 31, 2017

Copy link
Copy Markdown
Member

Fix #229

@mtrmac PTAL

Signed-off-by: Antonio Murdaca [email protected]

@mtrmac mtrmac left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Broadly LGTM, just a few nits.

Also please consider adding a comment explaining why we can assume gzip, per #229 (comment) etc.

Comment thread image/docker_schema2.go
if err != nil {
return nil, err
}
configOCI := &imgspecv1.Image{}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It’s non-obvious what this does. This would benefit from a comment, saying something like “The two versions of config are mostly compatible, but v2s2 has an extra $name field; this unmarshal+re-marshal effectively drops it.”

Comment thread image/docker_schema2.go Outdated
@@ -197,7 +208,7 @@ func (m *manifestSchema2) convertToManifestOCI1() (types.Image, error) {
// Rather than copying the ConfigBlob now, we just pass m.src to the
// translated manifest, since the only difference is the mediatype of
// descriptors there is no change to any blob stored in m.src.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This comment is no longer true. (Passing m.src is fine, just don’t say that we are not copying the ConfigBlob.)

Comment thread image/docker_schema2.go Outdated
config := descriptor{}
config.MediaType = imgspecv1.MediaTypeImageConfig
config.Size = int64(len(configOCIBytes))
config.Digest = digest.FromBytes(configOCIBytes)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Use a single struct initializer,

config := descriptor{
    MediaType: …,
    Size: …,
…
}

?

@runcom
runcom force-pushed the fix-oci-image-config branch from 601f979 to 5987a03 Compare January 31, 2017 16:40
@runcom

runcom commented Jan 31, 2017

Copy link
Copy Markdown
Member Author

@mtrmac PTAL

@mtrmac

mtrmac commented Jan 31, 2017 •

Copy link
Copy Markdown
Collaborator

👍 pending tests.

Approved with PullApprove

@runcom

runcom commented Jan 31, 2017 •

Copy link
Copy Markdown
Member Author

👍

Approved with PullApprove

@runcom

runcom commented Jan 31, 2017

Copy link
Copy Markdown
Member Author

Wait, I forgot to add a comment on why we assume gzip, fixing it

@runcom
runcom force-pushed the fix-oci-image-config branch from 5987a03 to 0db77be Compare January 31, 2017 16:59
@runcom
runcom merged commit 839fb0d into containers:master Jan 31, 2017
@runcom
runcom deleted the fix-oci-image-config branch January 31, 2017 17:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants