Allow lookup of "dead" manifests so manifest links can be clicked in the tag history
Fixes https://jira.coreos.com/browse/QUAY-1021
This commit is contained in:
parent
f6902f8096
commit
590f8f65a3
2 changed files with 16 additions and 11 deletions
|
@ -649,9 +649,9 @@ def delete_manifest_by_digest(namespace, repo_name, digest):
|
|||
return [tag_manifest.tag for tag_manifest in tag_manifests]
|
||||
|
||||
|
||||
def load_manifest_by_digest(namespace, repo_name, digest):
|
||||
def load_manifest_by_digest(namespace, repo_name, digest, allow_dead=False):
|
||||
try:
|
||||
return (_load_repo_manifests(namespace, repo_name)
|
||||
return (_load_repo_manifests(namespace, repo_name, allow_dead=allow_dead)
|
||||
.where(TagManifest.digest == digest)
|
||||
.get())
|
||||
except TagManifest.DoesNotExist:
|
||||
|
@ -659,15 +659,19 @@ def load_manifest_by_digest(namespace, repo_name, digest):
|
|||
raise InvalidManifestException(msg)
|
||||
|
||||
|
||||
def _load_repo_manifests(namespace, repo_name):
|
||||
return _tag_alive(TagManifest
|
||||
.select(TagManifest, RepositoryTag)
|
||||
.join(RepositoryTag)
|
||||
.join(Image)
|
||||
.join(Repository)
|
||||
.join(Namespace, on=(Namespace.id == Repository.namespace_user))
|
||||
.where(Repository.name == repo_name, Namespace.username == namespace))
|
||||
def _load_repo_manifests(namespace, repo_name, allow_dead=False):
|
||||
query = (TagManifest
|
||||
.select(TagManifest, RepositoryTag)
|
||||
.join(RepositoryTag)
|
||||
.join(Image)
|
||||
.join(Repository)
|
||||
.join(Namespace, on=(Namespace.id == Repository.namespace_user))
|
||||
.where(Repository.name == repo_name, Namespace.username == namespace))
|
||||
|
||||
if not allow_dead:
|
||||
query = _tag_alive(query)
|
||||
|
||||
return query
|
||||
|
||||
def change_repository_tag_expiration(namespace_name, repo_name, tag_name, expiration_date):
|
||||
""" Changes the expiration of the tag with the given name to the given expiration datetime. If
|
||||
|
|
|
@ -41,7 +41,8 @@ class ManifestLabelPreOCI(ManifestLabelInterface):
|
|||
|
||||
def get_repository_manifest(self, namespace_name, repository_name, digest):
|
||||
try:
|
||||
tag_manifest = model.tag.load_manifest_by_digest(namespace_name, repository_name, digest)
|
||||
tag_manifest = model.tag.load_manifest_by_digest(namespace_name, repository_name, digest,
|
||||
allow_dead=True)
|
||||
except model.DataModelException:
|
||||
return None
|
||||
|
||||
|
|
Reference in a new issue