diff --git a/CHANGES/1231.bugfix b/CHANGES/1231.bugfix new file mode 100644 index 000000000..5c21ea979 --- /dev/null +++ b/CHANGES/1231.bugfix @@ -0,0 +1 @@ +Taught the Container Registry to accept docker schema2 sub-manifest types in OCI index. diff --git a/pulp_container/app/json_schemas.py b/pulp_container/app/json_schemas.py index 733b1a1a6..76f18e2a5 100644 --- a/pulp_container/app/json_schemas.py +++ b/pulp_container/app/json_schemas.py @@ -41,6 +41,8 @@ def get_descriptor_schema( allowed_media_types=[ MEDIA_TYPE.MANIFEST_OCI, MEDIA_TYPE.INDEX_OCI, + MEDIA_TYPE.MANIFEST_V2, + MEDIA_TYPE.MANIFEST_LIST, ], additional_properties={ "platform": { diff --git a/pulp_container/app/utils.py b/pulp_container/app/utils.py index 7a846615f..1daf6ff93 100644 --- a/pulp_container/app/utils.py +++ b/pulp_container/app/utils.py @@ -163,9 +163,10 @@ def determine_media_type_from_json(content_data): return media_type elif manifests := content_data.get("manifests"): if len(manifests): - if manifests[0].get("mediaType") in (MEDIA_TYPE.MANIFEST_V2, MEDIA_TYPE.MANIFEST_V1): - return MEDIA_TYPE.MANIFEST_LIST - elif manifests[0].get("mediaType") in (MEDIA_TYPE.MANIFEST_OCI, MEDIA_TYPE.INDEX_OCI): + # check if there is at least one oci manifest + if set([m["mediaType"] for m in manifests]).intersection( + (MEDIA_TYPE.MANIFEST_OCI, MEDIA_TYPE.INDEX_OCI) + ): return MEDIA_TYPE.INDEX_OCI return MEDIA_TYPE.MANIFEST_LIST else: