Fix lookup of manifests referenced solely by a manifest list
We need to ensure we can find them if there is an active tag pointing to the parent list
This commit is contained in:
parent
54904cfd6e
commit
e972e4088b
5 changed files with 97 additions and 13 deletions
|
@ -20,6 +20,7 @@ class V2ProtocolSteps(Enum):
|
|||
AUTH = 'auth'
|
||||
BLOB_HEAD_CHECK = 'blob-head-check'
|
||||
GET_MANIFEST = 'get-manifest'
|
||||
GET_MANIFEST_LIST = 'get-manifest-list'
|
||||
PUT_MANIFEST = 'put-manifest'
|
||||
PUT_MANIFEST_LIST = 'put-manifest-list'
|
||||
MOUNT_BLOB = 'mount-blob'
|
||||
|
@ -147,7 +148,7 @@ class V2Protocol(RegistryProtocol):
|
|||
|
||||
headers = {
|
||||
'Authorization': 'Bearer ' + token,
|
||||
'Accept': DOCKER_SCHEMA2_MANIFESTLIST_CONTENT_TYPE,
|
||||
'Accept': ','.join(DOCKER_SCHEMA2_CONTENT_TYPES),
|
||||
}
|
||||
|
||||
for tag_name in tag_names:
|
||||
|
@ -155,18 +156,33 @@ class V2Protocol(RegistryProtocol):
|
|||
response = self.conduct(session, 'GET',
|
||||
'/v2/%s/manifests/%s' % (self.repo_name(namespace, repo_name),
|
||||
tag_name),
|
||||
expected_status=(200, expected_failure, V2ProtocolSteps.GET_MANIFEST),
|
||||
expected_status=(200, expected_failure,
|
||||
V2ProtocolSteps.GET_MANIFEST_LIST),
|
||||
headers=headers)
|
||||
if expected_failure is not None:
|
||||
return None
|
||||
|
||||
# Parse the returned manifest list and ensure it matches.
|
||||
assert response.headers['Content-Type'] == DOCKER_SCHEMA2_MANIFESTLIST_CONTENT_TYPE
|
||||
manifest = parse_manifest_from_bytes(response.text, response.headers['Content-Type'])
|
||||
assert manifest.schema_version == 2
|
||||
assert manifest.is_manifest_list
|
||||
assert manifest.digest == manifestlist.digest
|
||||
retrieved = parse_manifest_from_bytes(response.text, response.headers['Content-Type'])
|
||||
assert retrieved.schema_version == 2
|
||||
assert retrieved.is_manifest_list
|
||||
assert retrieved.digest == manifestlist.digest
|
||||
|
||||
# Pull each of the manifests inside and ensure they can be retrieved.
|
||||
for manifest_digest in retrieved.child_manifest_digests():
|
||||
response = self.conduct(session, 'GET',
|
||||
'/v2/%s/manifests/%s' % (self.repo_name(namespace, repo_name),
|
||||
manifest_digest),
|
||||
expected_status=(200, expected_failure,
|
||||
V2ProtocolSteps.GET_MANIFEST),
|
||||
headers=headers)
|
||||
if expected_failure is not None:
|
||||
return None
|
||||
|
||||
manifest = parse_manifest_from_bytes(response.text, response.headers['Content-Type'])
|
||||
assert not manifest.is_manifest_list
|
||||
assert manifest.digest == manifest_digest
|
||||
|
||||
def push_list(self, session, namespace, repo_name, tag_names, manifestlist, manifests, blobs,
|
||||
credentials=None, expected_failure=None, options=None):
|
||||
|
|
Reference in a new issue