Skip to content

Commit

Permalink
Taught registry to sync/upload oci index that contains docker sub-man…
Browse files Browse the repository at this point in the history
…ifests.

closes #1231

(cherry picked from commit 2bc5730)
  • Loading branch information
ipanova authored and lubosmj committed Jan 15, 2024
1 parent 56d56cb commit 4389dce
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES/1231.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Taught the Container Registry to accept docker schema2 sub-manifest types in OCI index.
2 changes: 2 additions & 0 deletions pulp_container/app/json_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
7 changes: 4 additions & 3 deletions pulp_container/app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 4389dce

Please sign in to comment.