feat(api/tag): generate manifest on tag

This commit is contained in:
EvB 2017-05-02 15:47:59 -04:00
parent 105acbc041
commit f7bf6a223c

View file

@ -8,6 +8,7 @@ from endpoints.api import (resource, nickname, require_repo_read, require_repo_w
disallow_for_app_repositories, disallow_under_trust)
from endpoints.exception import NotFound
from endpoints.api.image import image_view
from endpoints.v2.manifest import _generate_and_store_manifest
from data import model
from auth.auth_context import get_authenticated_user
from util.names import TAG_ERROR, TAG_REGEX
@ -111,11 +112,16 @@ class RepositoryTag(RepositoryParamResource):
model.tag.create_or_update_tag(namespace, repository, tag, image_id)
username = get_authenticated_user().username
log_action('move_tag' if original_image_id else 'create_tag', namespace,
{'username': username, 'repo': repository, 'tag': tag,
'namespace': namespace, 'image': image_id,
'original_image': original_image_id},
repo=model.repository.get_repository(namespace, repository))
tag_data = {'username': username, 'repo': repository, 'tag': tag, 'namespace': namespace,
'image': image_id, 'original_image': original_image_id}
log_action('move_tag' if original_image_id else 'create_tag', namespace, tag_data,
repo=model.repository.get_repository(namespace, repository))
try:
_generate_and_store_manifest(namespace, repository, tag)
except:
# log and move on since we'll attempt to store manifest on first pull as well
logger.exception('unable to store manifest for tag', extra=tag_data)
return 'Updated', 201