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

imagetools(create): set correct media type when combining manifests #1797

Merged
merged 1 commit into from
May 18, 2023

Conversation

crazy-max
Copy link
Member

@crazy-max crazy-max commented May 12, 2023

When using imagetools create and combining multiple sources we should check the media type of each manifest and set the right media type for the manifest list.

If there is a mismatch we set OCI index as best effort.

@crazy-max crazy-max added this to the v0.11.0 milestone May 12, 2023
}

var mt string
if cnt, ok := mfstmt[ocispec.MediaTypeImageManifest]; ok && cnt == len(newDescs) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Obviously the edgiest of edge cases 😄

But I think this does the wrong thing if we have a nested index? e.g. if we have oci indexes nested inside an oci index? In that case, we should still use the oci type.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hum right we don't handle nested indexes in addDesc atm

Copy link
Collaborator

Choose a reason for hiding this comment

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

What about this as an alternative: we should check for a prefix of application/vnd.docker to see if all the types are docker types, then use a docker manifest list in that case. If they are all OCI or even just mix-and-matched, then we should default to OCI.

Copy link
Member Author

Choose a reason for hiding this comment

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

As discussed yesterday, I'm fine defaulting to OCI.

When using imagetools create and combining multiple sources
we should check the media type of each manifest and set
the right media type for the manifest list.

If there is a mismatch we set OCI index as best effort.

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
@jedevc jedevc merged commit 167cd16 into docker:master May 18, 2023
54 checks passed
@crazy-max crazy-max deleted the fix-image-create branch May 18, 2023 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants