Add support for tag expiration based on a quay.expires-after label

This commit is contained in:
Joseph Schorr 2017-06-19 19:03:10 -04:00
parent 4663bf4194
commit c5d8b5f86b
5 changed files with 88 additions and 4 deletions

View file

@ -250,6 +250,14 @@ class PreOCIModel(DockerRegistryV2DataInterface):
blob_record = model.storage.get_storage_by_uuid(blob.uuid)
return model.storage.get_layer_path(blob_record)
def set_manifest_expires_after(self, namespace_name, repo_name, digest, expires_after_sec):
try:
manifest = model.tag.load_manifest_by_digest(namespace_name, repo_name, digest)
manifest.tag.lifetime_end_ts = manifest.tag.lifetime_start_ts + expires_after_sec
manifest.tag.save()
except model.InvalidManifestException:
return
def _docker_v1_metadata(namespace_name, repo_name, repo_image):
"""