Skip to content

Conversation

@runcom
Copy link
Member

@runcom runcom commented Oct 1, 2016

Related to #114

Needed for projectatomic/docker#200 - w/o this pulling an image with a manifest list is broken into docker.
Rigth now, by not supporting the manifest list media type we always got the single manifest for the amd64 arch instead of the whole manifest list and this broke docker because computing the digest for that single manifest isn't the same as the digest from the manifest list.

Also note that if you pull-by-digest a manifest list in docker you get back exactly the same manifest list digest (and not the one from the target manifest) which is confusing to me but still, it's how docker works.

@mtrmac PTAL - this is blocking

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

@runcom
Copy link
Member Author

runcom commented Oct 2, 2016

Test are failing in skopeo because estesp/busybox is a manifest list (and we already had this issue in the past). We really need a way for this, otherwise we'll break docker in projectatomic/docker#200.

@runcom
Copy link
Member Author

runcom commented Oct 2, 2016

I need to fix image.getParsedManifest to deal with manifest lists (unsure on the approach though)

Manifest lists don't carry configuration or such, I think from a manifest list we need to resolve the target manifest for the current arch+platform (as docker does) and transparently work with that. Still, we need to enable this. I'll fix this tomorrow.

@runcom
Copy link
Member Author

runcom commented Oct 2, 2016

@mtrmac I believe that by transparently resolving the target manifest for the current platform+arch we won't break signatures since we're going to retrieve and play with the correct single manifest.
The fact that it's a manifest list to me means only that we need another step to retrieve the current correct manifest and nothing else changes. I hope I'm correct.

@runcom runcom changed the title manifest: enable DockerV2List WIP: manifest: enable DockerV2List Oct 3, 2016
@runcom
Copy link
Member Author

runcom commented Oct 3, 2016

@mtrmac I've added a new GetTargetManifest(reference string) to image source in order to retrieve a manifest from a manifest list. It could be called GetManifestFromList() maybe and if the image's manifest for that image isn't a manifest list it errors out? wdyt?

OCI has this concept of a manifest list also, it makes sense have this new method in the image source interface. GetManifestFromList(arch, platform, ...) or GetTargetManifest(arch, platform, ...).

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.

So if I understand this correctly, Manifest and ManifestDigest will return the data of the manifest list, but LayerInfos etc. would all work with the underlying manifest data.

This works for the interface of types.Image narrowly read, and I guess it does allow signing of, and verifying signatures of, manifest lists, but it seems that it would completely break copy.Image; that method does need to know that there is a separate manifest list and a separate manifest to copy, and to copy both (or to copy all of the listed images, even).

}

// GetTargetManifest ...
func (s *dockerImageSource) GetTargetManifest(reference string) ([]byte, string, error) {
Copy link
Collaborator

@mtrmac mtrmac Oct 3, 2016

Choose a reason for hiding this comment

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

This will need a documented semantics for reference (this is definitely not a Docker reference, nor a ImageReference. I guess the input should be a digest, of perhaps a types.BlobInfo, like in GetBlob.

OCI has this concept of a manifest list also, it makes sense have this new method in the image source interface. GetManifestFromList(arch, platform, ...) or GetTargetManifest(arch, platform, ...).

I think parsing the lists and matching by arch/platform belongs to the manifest parsing code in image, not in the individual ImageSources.

Copy link
Collaborator

Choose a reason for hiding this comment

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

There really should be a single function with this code, shared by GetTargetManifest and ensureManifestIsLoaded.

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 parsing the lists and matching by arch/platform belongs to the manifest parsing code in image, not in the individual ImageSources.

isn't it that way now? that code is in image/docker_list.go

Copy link
Collaborator

Choose a reason for hiding this comment

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

The method declaration quoted above, and “new method in the image source interface”, are in ImageSource.

(To be clear, ImageSource.GetManifestByDigest is perfectly fine; I didn’t like the rch/platform logic in the sources.)

if err != nil {
return nil, err
}
switch mt {
Copy link
Collaborator

@mtrmac mtrmac Oct 3, 2016

Choose a reason for hiding this comment

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

This switch should really be shared with the one in genericImage.getParsedManifest. Add an genericImage.manifestInstanceFromBlob and call it from both places?

@mtrmac
Copy link
Collaborator

mtrmac commented Oct 3, 2016

I guess, to proceed for now, add an Image.IsMultiArchImage (Image.IsManifestList to more directly refer to the implementation?), and completely refuse to work with such things at the start of copy.Image?

That might allow not regressing docker, while we would more or less still refuse to sign/verify such images in skopeo. Assuming that they don’t become widespread…

@mtrmac
Copy link
Collaborator

mtrmac commented Oct 3, 2016

Test are failing in skopeo because estesp/busybox is a manifest list (and we already had this issue in the past). We really need a way for this, otherwise we'll break docker in projectatomic/docker#200.

We use estesp/busybox mostly to get a schema1 manifest for OpenShfit, and that runs into other difficulties for #88 .

I think a natural way to solve both is to use the v2 docker registry, which accepts schema 2, in most of those tests (e.g. those which deal with signature and policy semantics); then we can use an ordinary non-manifest-list image like busybox for them, and then add a separate set of tests for OpenShift which focus primarily on the copying of data in and out in various schemas etc.

We’ll see which one of us will run into these test issues harder/sooner and actually update the tests that way 😀

@runcom
Copy link
Member Author

runcom commented Oct 4, 2016

We’ll see which one of us will run into these test issues harder/sooner and actually update the tests that way

I have that on my todo list since this stuff were in skopeo :( I'll try to find some time to really do that I promise :(

@runcom
Copy link
Member Author

runcom commented Oct 4, 2016

@mtrmac updated the code, I still have to write down doc for GetTargetManifest and fix the other image transports, I'd like your ack before moving on :P

@mtrmac
Copy link
Collaborator

mtrmac commented Oct 4, 2016

Make copy.Image fail if IsMultiImage, and consider this ACKed.

@runcom
Copy link
Member Author

runcom commented Oct 6, 2016

@mtrmac PTAL

@runcom runcom changed the title WIP: manifest: enable DockerV2List manifest: enable DockerV2List Oct 6, 2016
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.

ACK apart from the two minor points.

}

// A ManifestDescriptor references a platform-specific manifest.
type ManifestDescriptor struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can be a private type

}

type manifestList struct {
src types.ImageSource
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unused AFAICS.

Signed-off-by: Antonio Murdaca <[email protected]>
@runcom
Copy link
Member Author

runcom commented Oct 6, 2016

@mtrmac fixed those 2 minor points

@mtrmac
Copy link
Collaborator

mtrmac commented Oct 6, 2016

👍, thanks!

Approved with PullApprove

@runcom
Copy link
Member Author

runcom commented Oct 6, 2016

lgtm (merging after tests)

Approved with PullApprove

@runcom
Copy link
Member Author

runcom commented Oct 6, 2016

merging, I'll fix skopeo asap and use a not-manifest-list image (like the official busybox)

@runcom runcom merged commit 3c70e7a into containers:master Oct 6, 2016
@runcom runcom deleted the manifeset-list branch October 6, 2016 15:19
@mtrmac
Copy link
Collaborator

mtrmac commented Oct 6, 2016

merging, I'll fix skopeo asap and use a not-manifest-list image (like the official busybox)

With these non-trivial test failures, I would really prefer for the test fix PR to be ready and reviewed before the containers/image part goes in. Not doing that effectively prevents merging anything else into containers/image.

return fmt.Errorf("can not copy %s: manifest contains multiple images", transports.ImageName(srcRef))
}

// Please keep this policy check BEFORE reading any other information about the image.
Copy link
Collaborator

@mtrmac mtrmac Oct 6, 2016

Choose a reason for hiding this comment

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

Heh, right below the added code is this comment and neither of as has noticed :) So much for comments.

I’ll fix that…

mtrmac added a commit to mtrmac/image that referenced this pull request Oct 6, 2016
@mtrmac mtrmac mentioned this pull request Oct 6, 2016
mtrmac added a commit to mtrmac/image that referenced this pull request Oct 7, 2016
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