Spawn the repo_push event in V2

Fixes #403
This commit is contained in:
Joseph Schorr 2015-08-25 16:02:21 -04:00
parent d9973af1df
commit aa90caa97e

View file

@ -20,6 +20,8 @@ from endpoints.decorators import anon_protect
from endpoints.v2 import v2_bp, require_repo_read, require_repo_write
from endpoints.v2.errors import (ManifestBlobUnknown, ManifestInvalid, ManifestUnverified,
ManifestUnknown, TagInvalid, NameInvalid)
from endpoints.trackhelper import track_and_log
from endpoints.notificationhelper import spawn_notification
from digest import digest_tools
from data import model
@ -278,6 +280,16 @@ def _write_manifest(namespace, repo_name, manifest):
model.tag.store_tag_manifest(namespace, repo_name, tag_name, leaf_layer.v1_metadata.docker_id,
manifest_digest, request.data)
# Spawn the repo_push event.
repo = model.repository.get_repository(namespace, repo_name)
if repo is not None:
event_data = {
'updated_tags': [tag_name],
}
track_and_log('push_repo', repo)
spawn_notification(repo, 'repo_push', event_data)
response = make_response('OK', 202)
response.headers['Docker-Content-Digest'] = manifest_digest
response.headers['Location'] = 'https://fun.com'