-
Notifications
You must be signed in to change notification settings - Fork 367
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
image: implement Docker v1 -> OCI conversion #380
Conversation
This partially fixes containers/skopeo#290 (which I believe was erroneously closed):
|
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.
Thanks!
(It would be nice to have at least a smoke test to ensure this keeps working, the manifest conversions are more or less the trickiest code in the repo. Still, non-blocking, better to have an untested conversion than no conversion.)
image/docker_schema1.go
Outdated
@@ -343,8 +354,8 @@ func (m *manifestSchema1) convertToManifestSchema2(uploadedLayerInfos []types.Bl | |||
Digest: digest.FromBytes(configJSON), | |||
} | |||
|
|||
m2 := manifestSchema2FromComponents(configDescriptor, nil, configJSON, layers) | |||
return memoryImageFromManifest(m2), nil | |||
m2 := manifestSchema2FromComponents(configDescriptor, nil, configJSON, layers).(*manifestSchema2) |
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.
Redeclare manifestSchema2FromComponents
to return a *manifestSchema2
explicitly instead of making a runtime cast here.
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.
… actually, is either necessary? AFAICT both memoryImageFromManifest
and .UpdatedImage()
can work on the genericManifest
interface.
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.
you're right, I'm dumb
image/docker_schema1.go
Outdated
m2 := manifestSchema2FromComponents(configDescriptor, nil, configJSON, layers) | ||
return memoryImageFromManifest(m2), nil | ||
m2 := manifestSchema2FromComponents(configDescriptor, nil, configJSON, layers).(*manifestSchema2) | ||
return m2, nil |
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.
(…and then this return
could be folded into the previous line. Non-blocking.)
image/docker_schema1.go
Outdated
if err != nil { | ||
return nil, err | ||
} | ||
return m2.UpdatedImage(options) |
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.
This might be a bit less risky with &types.ManifestUpdateOptions{ManifestMIMEType:imgspecv1.MediaTypeImageManifest}
instead of the full options
, to minimize what the m2.UpdatedImage
will do.
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.
… also include the original options.InformationOnly
member.
Thanks for the review, updated to address comments |
Please rebase also |
Since we already know how to convert from Docker V1 to V2 and from Docker V2 to OCI, we simply do a transitive manifest conversion. Signed-off-by: Jonathan Boulle <jonathanboulle@gmail.com>
Signed-off-by: Jonathan Boulle <jonathanboulle@gmail.com>
Signed-off-by: Jonathan Boulle <jonathanboulle@gmail.com>
rebased, thanks! |
Chasing containers#380; DiffIDs are required in the OCI format, but we were skipping them because of this check. Without this, converting from a V1 image registry source to an OCI layout results in broken images.
Chasing containers#380; DiffIDs are required in the OCI format, but we were skipping them because of this check. Without this, converting from a V1 image registry source to an OCI layout results in broken images. Signed-off-by: Jonathan Boulle <jonathanboulle@gmail.com>
Since we already know how to convert from Docker V1 to V2 and from
Docker V2 to OCI, we simply do a transitive manifest conversion.
Signed-off-by: Jonathan Boulle jonathanboulle@gmail.com