Skip to content

Commit

Permalink
CHECK-VERSIONS: Handle newer OCI Docker manifests
Browse files Browse the repository at this point in the history
They are almost the same as Docker original ones
  • Loading branch information
lephilousophe committed Oct 22, 2023
1 parent 8d8af0c commit e35e274
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions check-versions/docker_checkers.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ def parse_fat_manifest(reply, **kwargs):
if manifest_l.get('schemaVersion', None) != 2:
raise Exception("Invalid manifest version {1} for {0}".format(reply.url, manifest_l.get('schemaVersion', None)))

if manifest_l.get('mediaType', None) != 'application/vnd.docker.distribution.manifest.list.v2+json':
raise Exception("Invalid manifest mediaType {1} for {0}".format(reply.url, manifest_l.get('mediaType', None)))
mediaType = manifest_l.get('mediaType', None)
if (mediaType != 'application/vnd.docker.distribution.manifest.list.v2+json' and
mediaType != 'application/vnd.oci.image.index.v1+json'):
raise Exception("Invalid manifest mediaType {1} for {0}".format(reply.url, mediaType))

platforms = ((i, manifest['platform']) for i, manifest in enumerate(manifest_l['manifests']))
for name, value in kwargs.items():
Expand Down Expand Up @@ -153,7 +155,8 @@ def _fetch_digest(registry, image_name, reference, *, full=False, token=None, **
try:
with urlr.urlopen(req) as reply:
content_type = reply.getheader('Content-Type')
if content_type == 'application/vnd.docker.distribution.manifest.list.v2+json':
if (content_type == 'application/vnd.docker.distribution.manifest.list.v2+json' or
content_type == 'application/vnd.oci.image.index.v1+json'):
# For manifest list we really need the content
if full:
digest = parse_fat_manifest(reply, **kwargs)
Expand Down

0 comments on commit e35e274

Please sign in to comment.