Garbage collect repositories on push and on tag deletion.
This commit is contained in:
parent
732ce83795
commit
ef68982728
3 changed files with 38 additions and 16 deletions
|
@ -222,6 +222,8 @@ def update_images(namespace, repository):
|
|||
updated_tags[image['Tag']] = image['id']
|
||||
model.set_image_checksum(image['id'], repo, image['checksum'])
|
||||
|
||||
num_removed = model.garbage_collect_repository(namespace, repository)
|
||||
|
||||
# Generate a job for each webhook that has been added to this repo
|
||||
webhooks = model.list_webhooks(namespace, repository)
|
||||
for webhook in webhooks:
|
||||
|
@ -237,7 +239,8 @@ def update_images(namespace, repository):
|
|||
'homepage': 'https://quay.io/repository/%s' % repo_string,
|
||||
'visibility': repo.visibility.name,
|
||||
'updated_tags': updated_tags,
|
||||
'pushed_image_count': len(image_with_checksums),
|
||||
'pushed_image_count': len(image_with_checksums),
|
||||
'pruned_image_count': num_removed,
|
||||
}
|
||||
webhook_queue.put(json.dumps(webhook_data))
|
||||
|
||||
|
|
|
@ -73,21 +73,7 @@ def delete_tag(namespace, repository, tag):
|
|||
|
||||
if permission.can():
|
||||
model.delete_tag(namespace, repository, tag)
|
||||
|
||||
return make_response('Deleted', 204)
|
||||
|
||||
abort(403)
|
||||
|
||||
|
||||
@tags.route('/repositories/<path:repository>/tags',
|
||||
methods=['DELETE'])
|
||||
@process_auth
|
||||
@parse_repository_name
|
||||
def delete_repository_tags(namespace, repository):
|
||||
permission = ModifyRepositoryPermission(namespace, repository)
|
||||
|
||||
if permission.can():
|
||||
model.delete_all_repository_tags(namespace, repository)
|
||||
model.garbage_collect_repository(namespace, repository)
|
||||
|
||||
return make_response('Deleted', 204)
|
||||
|
||||
|
|
Reference in a new issue