Add manifest creation to new registry data model interface
This commit is contained in:
parent
818ed32f87
commit
0ae062be62
9 changed files with 195 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
|||
import logging
|
||||
|
||||
from calendar import timegm
|
||||
from datetime import datetime
|
||||
from uuid import uuid4
|
||||
|
||||
from peewee import IntegrityError, JOIN, fn
|
||||
|
@ -757,6 +758,16 @@ def change_repository_tag_expiration(namespace_name, repo_name, tag_name, expira
|
|||
return (None, False)
|
||||
|
||||
|
||||
def set_tag_expiration_for_manifest(tag_manifest, expiration_sec):
|
||||
"""
|
||||
Changes the expiration of the tag that point to the given manifest to be its lifetime start +
|
||||
the expiration seconds.
|
||||
"""
|
||||
expiration_time_in_seconds = tag_manifest.tag.lifetime_start_ts + expiration_sec
|
||||
expiration_date = datetime.utcfromtimestamp(expiration_time_in_seconds)
|
||||
return change_tag_expiration(tag_manifest.tag, expiration_date)
|
||||
|
||||
|
||||
def change_tag_expiration(tag, expiration_date):
|
||||
""" Changes the expiration of the given tag to the given expiration datetime. If
|
||||
the expiration datetime is None, then the tag is marked as not expiring.
|
||||
|
|
Reference in a new issue