-
Notifications
You must be signed in to change notification settings - Fork 588
Add --prefer-index flag forimagetools create on a single source
#2482
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
Add --prefer-index flag forimagetools create on a single source
#2482
Conversation
…to the list of mediatypes we return the original bytes for when calling *Resolver.Combine rather than adding it to a newly created manifest list Signed-off-by: Tim Smith <tismith@rvohealth.com>
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.
While I tend to agree that this makes more sense as a default behavior, this is removing the capability to convert image manifest into manifest list. Should we add a new flag that keeps previous behavior?
util/imagetools/create.go
Outdated
| // on single source, return original bytes | ||
| if len(srcs) == 1 && len(ann) == 0 { | ||
| if mt := srcs[0].Desc.MediaType; mt == images.MediaTypeDockerSchema2ManifestList || mt == ocispec.MediaTypeImageIndex { | ||
| if mt := srcs[0].Desc.MediaType; mt == images.MediaTypeDockerSchema2ManifestList || mt == images.MediaTypeDockerSchema2Manifest || mt == ocispec.MediaTypeImageIndex { |
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.
If that is the desired behavior then why is there a mediatype check at all, or at least why is ocispec.MediaTypeImageManifest missing?
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.
Ahhhhh great point! Yeah, it actually seems reasonable that there doesn't even need to be a check. Thinking through the logic, I guess I can't really think of when the logic would need to be different here. Seems like if there is one source and no annotations (and possibly if the --preserve-single-source flag is set to true, based on my response to your other comment), we should just return the original bytes. I almost feel like I'm missing something here though. It feels like this is here for a reason, but maybe it is just an oversight.
@tonistiigi great point. I was too focused on my own use case, but yeah, I definitely agree that some people are probably using this explicitly hoping to convert to a manifest list, or at the very least they've probably built workflows that are expecting this behavior, so changing the default behavior is probably too risky. So, 2 things:
Thoughts? |
|
Maybe smth. like |
Nice. I'll make some changes and push them up. |
…havior when deciding on how to create an image/manifest from a single source. Signed-off-by: Tim Smith <tismith@rvohealth.com>
…we return original bytes without filtering on mediaType, based on the preferIndex preference. Signed-off-by: Tim Smith <tismith@rvohealth.com>
Signed-off-by: Tim Smith <tismith@rvohealth.com>
…n index regardless of what value you specify. Signed-off-by: Tim Smith <tismith@rvohealth.com>
|
I split the difference and landed on |
Signed-off-by: Tim Smith <tismith@rvohealth.com>
--prefer-index flag which allows you to preserve the source manifest format instead of converting to a manifest list when calling imagetools create on a single source
--prefer-index flag which allows you to preserve the source manifest format instead of converting to a manifest list when calling imagetools create on a single source--prefer-index flag forimagetools create on a single source
--prefer-index flag forimagetools create on a single source--prefer-index flag forimagetools create on a single source

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

imagetools createwith single source changes copied image fromapplication/vnd.docker.distribution.manifest.v2+jsontoapplication/vnd.docker.distribution.manifest.list.v2+json#2481--prefer-index=false