Merge pull request #3204 from quay/joseph.schorr/QUAY-1030/registry-interface
Start on a basic registry_model interface
This commit is contained in:
commit
6414e580f6
7 changed files with 150 additions and 56 deletions
|
@ -721,3 +721,30 @@ def change_tag_expiration(tag, expiration_date):
|
|||
.execute())
|
||||
|
||||
return (tag.lifetime_end_ts, result > 0)
|
||||
|
||||
|
||||
def find_matching_tag(repo_id, tag_names):
|
||||
""" Finds the most recently pushed alive tag in the repository with one of the given names,
|
||||
if any.
|
||||
"""
|
||||
try:
|
||||
return (_tag_alive(RepositoryTag
|
||||
.select()
|
||||
.where(RepositoryTag.repository == repo_id,
|
||||
RepositoryTag.name << list(tag_names))
|
||||
.order_by(RepositoryTag.lifetime_start_ts.desc()))
|
||||
.get())
|
||||
except RepositoryTag.DoesNotExist:
|
||||
return None
|
||||
|
||||
|
||||
def get_most_recent_tag(repo_id):
|
||||
""" Returns the most recently pushed alive tag in the repository, or None if none. """
|
||||
try:
|
||||
return (_tag_alive(RepositoryTag
|
||||
.select()
|
||||
.where(RepositoryTag.repository == repo_id)
|
||||
.order_by(RepositoryTag.lifetime_start_ts.desc()))
|
||||
.get())
|
||||
except RepositoryTag.DoesNotExist:
|
||||
return None
|
||||
|
|
Reference in a new issue