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
  • Loading branch information
ipanova committed May 30, 2023
1 parent 27f64fd commit b8d22ce
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 @@
Tought 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 @@ -37,6 +37,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 b8d22ce

Please sign in to comment.