diff --git a/data/model/tag.py b/data/model/tag.py index b020f019a..b314be476 100644 --- a/data/model/tag.py +++ b/data/model/tag.py @@ -164,8 +164,15 @@ def revert_tag(repo_obj, tag_name, docker_image_id): def store_tag_manifest(namespace, repo_name, tag_name, docker_image_id, manifest_digest, manifest_data): - tag = create_or_update_tag(namespace, repo_name, tag_name, docker_image_id) - return TagManifest.create(tag=tag, digest=manifest_digest, json_data=manifest_data) + with db_transaction(): + tag = create_or_update_tag(namespace, repo_name, tag_name, docker_image_id) + + try: + manifest = TagManifest.get(digest=manifest_digest) + manifest.tag = tag + manifest.save() + except TagManifest.DoesNotExist: + return TagManifest.create(tag=tag, digest=manifest_digest, json_data=manifest_data) def _get_active_tag(namespace, repo_name, tag_name):