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
|
@ -37,10 +37,12 @@ def _label_dict(label):
|
|||
def _layer_dict(manifest_layer, index):
|
||||
# NOTE: The `command` in the layer is either a JSON string of an array (schema 1) or
|
||||
# a single string (schema 2). The block below normalizes it to have the same format.
|
||||
try:
|
||||
command = json.loads(manifest_layer.command)
|
||||
except (TypeError, ValueError):
|
||||
command = [manifest_layer.command]
|
||||
command = None
|
||||
if manifest_layer.command:
|
||||
try:
|
||||
command = json.loads(manifest_layer.command)
|
||||
except (TypeError, ValueError):
|
||||
command = [manifest_layer.command]
|
||||
|
||||
return {
|
||||
'index': index,
|
||||
|
@ -48,6 +50,8 @@ def _layer_dict(manifest_layer, index):
|
|||
'is_remote': manifest_layer.is_remote,
|
||||
'urls': manifest_layer.urls,
|
||||
'command': command,
|
||||
'comment': manifest_layer.comment,
|
||||
'author': manifest_layer.author,
|
||||
'blob_digest': str(manifest_layer.blob_digest),
|
||||
'created_datetime': format_date(manifest_layer.created_datetime),
|
||||
}
|
||||
|
|
Reference in a new issue