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

Support pulling/pushing OCI manifests from a docker registry #338

Merged
merged 2 commits into from
Sep 7, 2017

Conversation

owtaylor
Copy link
Contributor

This pull request has a tiny one-line patch to add imgspecv1.MediaTypeImageManifest to the list of MIME types that a docker registry might support (as always, the exact list depends on the version of the registry we are talking to), and a bigger, though still trivial patch that prevents some breakage from the change - as discussed in #331.

(With the obvious compilation fix to skopeo, the skopeo tests all pass with these changes.)

The breakage that is avoided is that for copying from docker to oci, we don't want to pass only the imgspecv1.MediaTypeImageManifest in the Accept header - a) the particular docker registry might not in fact support imgspecv1.MediaTypeImageManifest b) and if it did, the particular manifest being requested might not be a imgspecv1.MediaTypeImageManifest, instead we want to pass in our normal list, get the manifest in it's original form and convert if necessary.

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

Thanks!

ACK, just two trivial things.

Could you also prepare the skopeo update, please, per https://github.com/projectatomic/skopeo/blob/master/README.md#dependencies-management ?

(Right now you are probably seeing unrelated failures due to containers/skopeo#399 / containers/skopeo#399 (comment) )

copy/copy.go Outdated
@@ -195,6 +193,7 @@ func Image(policyContext *signature.PolicyContext, destRef, srcRef types.ImageRe

// We compute preferredManifestMIMEType only to show it in error messages.
// Without having to add this context in an error message, we would be happy enough to know only that no conversion is needed.
destSupportedManifestMIMETypes := dest.SupportedManifestMIMETypes()
preferredManifestMIMEType, otherManifestMIMETypeCandidates, err := determineManifestConversion(&manifestUpdates, src, destSupportedManifestMIMETypes, canModifyManifest)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: inlining the call directly and eliminating the variable would be shorter.

if requestedManifestMIMETypes == nil {
requestedManifestMIMETypes = manifest.DefaultRequestedManifestMIMETypes
}
supportedMIMEs := supportedManifestMIMETypesMap()
Copy link
Collaborator

Choose a reason for hiding this comment

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

This removes the only user of supportedManifestMIMETypesMap; can you remove it, please, and perhaps inline the global manifestMIMETypes variable into dockerImageDestination.SupportedManifestMIMETypes?

@owtaylor
Copy link
Contributor Author

The latest set of pushes makes both code improvements you suggested, and the skopeo update is in containers/skopeo#403.

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

👍

Please drop the backup files though.

@@ -0,0 +1,15 @@
diff a/oci/layout/oci_transport.go b/oci/layout/oci_transport.go (rejected hunks)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please drop this file.

@@ -0,0 +1,366 @@
package signature
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please drop this file.

@owtaylor
Copy link
Contributor Author

Oy, sorry about the stray files! Should not have deviated from my normal git habits. Fixed now.

@mtrmac
Copy link
Collaborator

mtrmac commented Aug 31, 2017

git-validation -q -run DCO,short-subject,dangling-whitespace
 52ececd - FAIL - does not have a valid DCO
 be736b4 - FAIL - does not have a valid DCO

(git commit --amend -s)

@owtaylor
Copy link
Contributor Author

Added the sign-offs

@mtrmac
Copy link
Collaborator

mtrmac commented Aug 31, 2017

👍 pending tests

Approved with PullApprove

@owtaylor
Copy link
Contributor Author

👍 pending tests

What tests are you waiting for? containers/skopeo#403 seems to pass (can repush with a sign-off now, or just do that when rebasing when this lands), tests here aren't going to pass.

@mtrmac
Copy link
Collaborator

mtrmac commented Sep 1, 2017

What tests are you waiting for?

You’re right, some failures are expected; just to make sure there are no unexpected failures. E.g. right now, please run

gofmt -s -w docker/docker_image_src.go openshift/openshift.go

@owtaylor
Copy link
Contributor Author

owtaylor commented Sep 2, 2017

You’re right, some failures are expected; just to make sure there are no unexpected failures. E.g. right now, please run

gofmt -s -w docker/docker_image_src.go openshift/openshift.go

Good point. Repushed with the go fmt changes.

@mtrmac
Copy link
Collaborator

mtrmac commented Sep 4, 2017

One more test failure, due to #314 landing since the original PR was prepared.

…meter

The requestedManifestMIMETypes parameter was added because a destination
might not support all manifest MIME types that the the source supports,
but the original use case now passes all manifest types and lets
containers/image convert internally. In generally, internal conversion
may be more comprehensive, is more predictable, and avoids bypassing
internal checks.

Fixes: containers#331
Signed-off-by: Owen W. Taylor <otaylor@fishsoup.net>
Since OCI support is in progress for the docker registry, if we have
an OCI manifest, we should try uploading it literally to the registry
before falling back to converting it to a v2 manifest.

Signed-off-by: Owen W. Taylor <otaylor@fishsoup.net>
@owtaylor
Copy link
Contributor Author

owtaylor commented Sep 7, 2017

This and containers/skopeo#403 are now rebased on top of the latest code and (I think) passing all the tests they are supposed to pass.

@mtrmac mtrmac merged commit 742b329 into containers:master Sep 7, 2017
@mtrmac
Copy link
Collaborator

mtrmac commented Sep 7, 2017

Thanks! Please re-vendor containers/skopeo#403 back to the master branch.

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.

2 participants