Support v1 container image manifests
This is needed to support inspecting images served by quay.io. Apparently this old manifest version is the only one supported by quay.io. This is required for tripleo-openshift, as some images are hosted on quay.io. Change-Id: I4c64848c7eb21cd4370c9be72cea842863513c01 Closes-Bug: #1799396
This commit is contained in:
@@ -364,34 +364,45 @@ class BaseImageUploader(object):
|
||||
tags_r.raise_for_status()
|
||||
|
||||
manifest = manifest_r.json()
|
||||
layers = [l['digest'] for l in manifest['layers']]
|
||||
digest = manifest_r.headers['Docker-Content-Digest']
|
||||
if manifest['schemaVersion'] == 1:
|
||||
config = json.loads(manifest['history'][0]['v1Compatibility'])
|
||||
layers = list(reversed([l['blobSum']
|
||||
for l in manifest['fsLayers']]))
|
||||
else:
|
||||
layers = [l['digest'] for l in manifest['layers']]
|
||||
|
||||
parts['config_digest'] = manifest['config']['digest']
|
||||
config_headers = {
|
||||
'Accept': manifest['config']['mediaType']
|
||||
}
|
||||
config_url = cls._build_url(
|
||||
image_url, '%(image)s/blobs/%(config_digest)s' % parts,
|
||||
insecure, mirrors)
|
||||
config_f = p.submit(
|
||||
session.get, config_url, headers=config_headers, timeout=30)
|
||||
config_r = config_f.result()
|
||||
config_r.raise_for_status()
|
||||
parts['config_digest'] = manifest['config']['digest']
|
||||
config_headers = {
|
||||
'Accept': manifest['config']['mediaType']
|
||||
}
|
||||
config_url = cls._build_url(
|
||||
image_url, '%(image)s/blobs/%(config_digest)s' % parts,
|
||||
insecure, mirrors)
|
||||
config_f = p.submit(
|
||||
session.get, config_url, headers=config_headers, timeout=30)
|
||||
config_r = config_f.result()
|
||||
config_r.raise_for_status()
|
||||
config = config_r.json()
|
||||
|
||||
tags = tags_r.json()['tags']
|
||||
digest = manifest_r.headers['Docker-Content-Digest']
|
||||
config = config_r.json()
|
||||
name = '%s%s' % (image_url.netloc, image)
|
||||
created = config['created']
|
||||
docker_version = config['docker_version']
|
||||
labels = config['config']['Labels']
|
||||
architecture = config['architecture']
|
||||
image_os = config['os']
|
||||
|
||||
return {
|
||||
'Name': name,
|
||||
'Tag': tag,
|
||||
'Digest': digest,
|
||||
'RepoTags': tags,
|
||||
'Created': config['created'],
|
||||
'DockerVersion': config['docker_version'],
|
||||
'Labels': config['config']['Labels'],
|
||||
'Architecture': config['architecture'],
|
||||
'Os': config['os'],
|
||||
'Created': created,
|
||||
'DockerVersion': docker_version,
|
||||
'Labels': labels,
|
||||
'Architecture': architecture,
|
||||
'Os': image_os,
|
||||
'Layers': layers,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user