Make command optional in schema 2 manifests (as per OCI spec) and pull out additional information
Also updates the manifest view page to show the comment or digest if there is no command defined
This commit is contained in:
parent
fc691cefb4
commit
71b7a2b3a2
7 changed files with 53 additions and 16 deletions
|
@ -82,7 +82,8 @@ class Schema1Layer(namedtuple('Schema1Layer', ['digest', 'v1_metadata', 'raw_v1_
|
|||
|
||||
|
||||
class Schema1V1Metadata(namedtuple('Schema1V1Metadata', ['image_id', 'parent_image_id', 'created',
|
||||
'comment', 'command', 'labels'])):
|
||||
'comment', 'command', 'author',
|
||||
'labels'])):
|
||||
"""
|
||||
Represents the necessary data extracted from the v1 compatibility string in a given layer of a
|
||||
Manifest.
|
||||
|
@ -315,6 +316,8 @@ class DockerSchema1Manifest(ManifestInterface):
|
|||
is_remote=False,
|
||||
urls=None,
|
||||
command=layer.v1_metadata.command,
|
||||
comment=layer.v1_metadata.comment,
|
||||
author=layer.v1_metadata.author,
|
||||
blob_digest=layer.digest,
|
||||
created_datetime=created_datetime,
|
||||
internal_layer=layer)
|
||||
|
@ -372,9 +375,13 @@ class DockerSchema1Manifest(ManifestInterface):
|
|||
raise MalformedSchema1Manifest('id field missing from v1Compatibility JSON')
|
||||
|
||||
labels = v1_metadata.get('config', {}).get('Labels', {}) or {}
|
||||
extracted = Schema1V1Metadata(v1_metadata['id'], v1_metadata.get('parent'),
|
||||
v1_metadata.get('created'), v1_metadata.get('comment'),
|
||||
command, labels)
|
||||
extracted = Schema1V1Metadata(image_id=v1_metadata['id'],
|
||||
parent_image_id=v1_metadata.get('parent'),
|
||||
created=v1_metadata.get('created'),
|
||||
comment=v1_metadata.get('comment'),
|
||||
author=v1_metadata.get('author'),
|
||||
command=command,
|
||||
labels=labels)
|
||||
|
||||
compressed_size = v1_metadata.get('Size')
|
||||
yield Schema1Layer(image_digest, extracted, metadata_string, compressed_size, False, None)
|
||||
|
@ -483,6 +490,7 @@ class DockerSchema1Manifest(ManifestInterface):
|
|||
image_id=working_image_id,
|
||||
created=extracted_v1_metadata.created,
|
||||
comment=extracted_v1_metadata.comment,
|
||||
author=extracted_v1_metadata.author,
|
||||
command=extracted_v1_metadata.command,
|
||||
compat_json=v1_metadata_json,
|
||||
parent_image_id=parent_image_id,
|
||||
|
|
Reference in a new issue