Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes #1553

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Command(BaseCommand):

def handle(self, *args, **options):
manifests = Manifest.objects.exclude(
media_type__in=[MEDIA_TYPE.MANIFEST_LIST, MEDIA_TYPE.INDEX_OCI]
media_type__in=[MEDIA_TYPE.MANIFEST_LIST, MEDIA_TYPE.INDEX_OCI, MEDIA_TYPE.MANIFEST_V1]
).order_by("pulp_id")
self.update_manifests(manifests)

Expand Down
3 changes: 3 additions & 0 deletions pulp_container/app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ def init_metadata(self, manifest_data=None):
return has_annotations or has_labels or has_image_nature

def init_annotations(self, manifest_data=None):
# annotations are part of OCI only
if self.media_type not in (MEDIA_TYPE.MANIFEST_OCI, MEDIA_TYPE.INDEX_OCI):
return False
if manifest_data is None:
manifest_artifact = self._artifacts.get()
manifest_data, _ = get_content_data(manifest_artifact)
Expand Down
4 changes: 3 additions & 1 deletion pulp_container/app/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,9 @@ async def init_pending_content(self, digest, manifest_data, media_type, artifact
config_blob=config_blob,
)

await sync_to_async(manifest.init_metadata)(manifest_data=manifest_data)
# skip if media_type of schema1
if media_type in (MEDIA_TYPE.MANIFEST_V2, MEDIA_TYPE.MANIFEST_OCI):
await sync_to_async(manifest.init_metadata)(manifest_data=manifest_data)

try:
await manifest.asave()
Expand Down
5 changes: 4 additions & 1 deletion pulp_container/app/tasks/sync_stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,10 @@ def create_tagged_manifest_list(self, tag_name, saved_artifact, manifest_list_da
"""
digest = f"sha256:{saved_artifact.sha256}"
manifest_list = Manifest(
digest=digest, schema_version=manifest_list_data["schemaVersion"], media_type=media_type
digest=digest,
schema_version=manifest_list_data["schemaVersion"],
media_type=media_type,
annotations=manifest_list_data.get("annotations", {}),
)

manifest_list_dc = self._create_manifest_declarative_content(
Expand Down
Loading