From aa90caa97e9204ba56dd0967c37d72f96a32178a Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 25 Aug 2015 16:02:21 -0400 Subject: [PATCH] Spawn the repo_push event in V2 Fixes #403 --- endpoints/v2/manifest.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/endpoints/v2/manifest.py b/endpoints/v2/manifest.py index fcc7cd3d8..9cf3bc954 100644 --- a/endpoints/v2/manifest.py +++ b/endpoints/v2/manifest.py @@ -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'