Add support for direct pushing of schema 2 manifests without tags
This is required for manifest lists
This commit is contained in:
parent
8a3427e55a
commit
e6c2ddfa93
6 changed files with 158 additions and 47 deletions
|
@ -219,17 +219,6 @@ class OCIModel(SharedModel, RegistryDataInterface):
|
|||
|
||||
Returns a reference to the (created manifest, tag) or (None, None) on error.
|
||||
"""
|
||||
def _retrieve_repo_blob(digest):
|
||||
blob_found = self.get_repo_blob_by_digest(repository_ref, digest, include_placements=True)
|
||||
if blob_found is None:
|
||||
return None
|
||||
|
||||
try:
|
||||
return storage.get_content(blob_found.placements, blob_found.storage_path)
|
||||
except IOError:
|
||||
logger.exception('Could not retrieve configuration blob `%s`', digest)
|
||||
return None
|
||||
|
||||
# Get or create the manifest itself.
|
||||
created_manifest = oci.manifest.get_or_create_manifest(repository_ref._db_id,
|
||||
manifest_interface_instance,
|
||||
|
@ -460,4 +449,26 @@ class OCIModel(SharedModel, RegistryDataInterface):
|
|||
retriever = RepositoryContentRetriever(manifest_row.repository_id, storage)
|
||||
return parsed.get_v1_compatible_manifest(namespace_name, repo_name, tag_name, retriever)
|
||||
|
||||
def create_manifest_with_temp_tag(self, repository_ref, manifest_interface_instance,
|
||||
expiration_sec, storage):
|
||||
""" Creates a manifest under the repository and sets a temporary tag to point to it.
|
||||
Returns the manifest object created or None on error.
|
||||
"""
|
||||
# Get or create the manifest itself.
|
||||
created_manifest = oci.manifest.get_or_create_manifest(repository_ref._db_id,
|
||||
manifest_interface_instance,
|
||||
storage)
|
||||
if created_manifest is None:
|
||||
return None
|
||||
|
||||
# Point a temporary tag to the manifest.
|
||||
tag = oci.tag.create_temporary_tag(created_manifest.manifest, expiration_sec)
|
||||
if tag is None:
|
||||
return None
|
||||
|
||||
legacy_image = oci.shared.get_legacy_image_for_manifest(created_manifest.manifest)
|
||||
li = LegacyImage.for_image(legacy_image)
|
||||
return Manifest.for_manifest(created_manifest.manifest, li)
|
||||
|
||||
|
||||
oci_model = OCIModel()
|
||||
|
|
Reference in a new issue