Support pulling of schema2 manifests directly via a manifest list tag
This change ensures that if a manifest list is requested with an accepts header for a *schema 2* manifest, the legacy manifest (if any) is returned as schema 2 if it was pushed as a schema 2 manifest (rather than being auto-converted to schema 1)
This commit is contained in:
parent
a35982f2be
commit
3c2e050593
14 changed files with 215 additions and 15 deletions
|
|
@ -299,6 +299,19 @@ class DockerSchema2Manifest(ManifestInterface):
|
|||
|
||||
return [l.v1_id for l in self._manifest_image_layers(content_retriever)]
|
||||
|
||||
def convert_manifest(self, allowed_mediatypes, namespace_name, repo_name, tag_name,
|
||||
content_retriever):
|
||||
if self.media_type in allowed_mediatypes:
|
||||
return self
|
||||
|
||||
# If this manifest is not on the allowed list, try to convert the schema 1 version (if any)
|
||||
schema1 = self.get_schema1_manifest(namespace_name, repo_name, tag_name, content_retriever)
|
||||
if schema1 is None:
|
||||
return None
|
||||
|
||||
return schema1.convert_manifest(allowed_mediatypes, namespace_name, repo_name, tag_name,
|
||||
content_retriever)
|
||||
|
||||
def get_schema1_manifest(self, namespace_name, repo_name, tag_name, content_retriever):
|
||||
if self.has_remote_layer:
|
||||
return None
|
||||
|
|
|
|||
Reference in a new issue