Skip to content

Commit

Permalink
cmd-copy-container: handle v2s2 manifest lists
Browse files Browse the repository at this point in the history
We need to support arch peeling even for multi-arch source containers
pushed using v2s2. Thankfully, the schema is identical to the OCI schema
for our purposes which makes supporting it painless.

Related: coreos#2726
(cherry picked from commit cd32708)
(cherry picked from commit 459831c)
(cherry picked from commit 4a2512c)
  • Loading branch information
jlebon authored and dustymabe committed Nov 10, 2022
1 parent 8f48b32 commit 2b34cfc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/cmd-copy-container
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ EXAMPLE_USAGE = """examples:
registry.ci.openshift.org/jlebon/fedora-coreos
"""

MEDIA_TYPE_IMAGE_INDEX = 'application/vnd.oci.image.index.v1+json'
MEDIA_TYPE_OCI_IMAGE_INDEX = 'application/vnd.oci.image.index.v1+json'
MEDIA_TYPE_DOCKER_MANIFEST_LIST = 'application/vnd.docker.distribution.manifest.list.v2+json'


def main():
Expand Down Expand Up @@ -48,7 +49,8 @@ def main():
copies[f'{args.src_repo}:{tag}'] = f'{args.dest_repo}:{tag}'
else:
inspect = skopeo_inspect(f'{args.src_repo}:{tag}', args.authfile)
if inspect.get('mediaType') != MEDIA_TYPE_IMAGE_INDEX:
if inspect.get('mediaType') not in [MEDIA_TYPE_OCI_IMAGE_INDEX,
MEDIA_TYPE_DOCKER_MANIFEST_LIST]:
# src is not manifest listed, so no arch peeling needed
copies[f'{args.src_repo}:{tag}'] = f'{args.dest_repo}:{tag}'
else:
Expand Down

0 comments on commit 2b34cfc

Please sign in to comment.