Merge pull request #3380 from quay/joseph.schorr/QUAY-1353/always-new-tag-manifest
Always create a new tag manifest row when backfilling in the old data model
This commit is contained in:
commit
b5a5ce7c43
2 changed files with 18 additions and 24 deletions
|
@ -727,12 +727,6 @@ def get_possibly_expired_tag(namespace, repo_name, tag_name):
|
|||
Namespace.username == namespace)).get()
|
||||
|
||||
def associate_generated_tag_manifest_with_tag(tag, manifest, storage_id_map):
|
||||
try:
|
||||
manifest = TagManifest.get(digest=manifest.digest)
|
||||
manifest.tag = tag
|
||||
manifest.save()
|
||||
return manifest, False
|
||||
except TagManifest.DoesNotExist:
|
||||
oci_manifest = _populate_manifest_and_blobs(tag.repository, manifest, storage_id_map)
|
||||
|
||||
with db_transaction():
|
||||
|
@ -750,7 +744,7 @@ def associate_generated_tag_manifest_with_tag(tag, manifest, storage_id_map):
|
|||
tag_kind=Tag.tag_kind.get_id('tag'))
|
||||
TagToRepositoryTag.create(tag=oci_tag, repository_tag=tag, repository=tag.repository)
|
||||
|
||||
return _associate_manifest(tag, oci_manifest), True
|
||||
return _associate_manifest(tag, oci_manifest)
|
||||
|
||||
|
||||
def _associate_manifest(tag, oci_manifest):
|
||||
|
|
|
@ -482,7 +482,7 @@ class PreOCIModel(SharedModel, RegistryDataInterface):
|
|||
blob_query = self._lookup_repo_storages_by_content_checksum(repo, manifest.checksums)
|
||||
storage_map = {blob.content_checksum: blob.id for blob in blob_query}
|
||||
try:
|
||||
tag_manifest, _ = model.tag.associate_generated_tag_manifest_with_tag(tag_obj, manifest,
|
||||
tag_manifest = model.tag.associate_generated_tag_manifest_with_tag(tag_obj, manifest,
|
||||
storage_map)
|
||||
assert tag_manifest
|
||||
except IntegrityError:
|
||||
|
|
Reference in a new issue