summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorAndre Guedes <andrebsguedes@gmail.com>2016-11-23 14:50:30 -0200
committerAndre Guedes <andrebsguedes@gmail.com>2017-02-22 11:29:06 -0300
commiteed0b85ad084ad4d13cc26907102063d9372fe75 (patch)
treea928cbbe20327724da7ee040963d5a25f285da53 /lib/api
parentdcd4beb8eb7bb7d0c2f720ef85c3da9f97a3dfe6 (diff)
downloadgitlab-ce-eed0b85ad084ad4d13cc26907102063d9372fe75.tar.gz
First iteration of container_image view
- Fixes project, container_image and tag deletion - Removed container_images_repository [ci skip]
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/registry_events.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/api/registry_events.rb b/lib/api/registry_events.rb
index c0473051424..dc7279d2b75 100644
--- a/lib/api/registry_events.rb
+++ b/lib/api/registry_events.rb
@@ -41,9 +41,19 @@ module API
if event['action'] == 'push' and !!event['target']['tag']
namespace, container_image_name = ContainerImage::split_namespace(repository)
- ::ContainerImagesRepositories::ContainerImages::PushService.new(
- Project::find_with_namespace(namespace), current_user
- ).execute(container_image_name, event)
+ project = Project::find_with_namespace(namespace)
+
+ if project
+ container_image = project.container_images.find_or_create_by(name: container_image_name)
+
+ if container_image.valid?
+ puts('Valid!')
+ else
+ render_api_error!({ error: "Failed to create container image!" }, 400)
+ end
+ else
+ not_found!('Project')
+ end
end
end
end