summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2018-11-12 19:18:57 +0100
committerMatija Čupić <matteeyah@gmail.com>2018-11-12 19:43:03 +0100
commit99203bfe23975b8dbbaa5daa613fbc90fd39178f (patch)
tree77ecf8ef90762f09b85e8cf5003d5c6e080171fd /lib/api
parent5b45cd246373f18bf678dbdecad589733cfec8b0 (diff)
downloadgitlab-ce-99203bfe23975b8dbbaa5daa613fbc90fd39178f.tar.gz
Destroy pipeline in service
Move all logic for destroying a Pipeline into a service so it's easily reusable.
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/pipelines.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/api/pipelines.rb b/lib/api/pipelines.rb
index d4bd4e71343..39d693bb9e9 100644
--- a/lib/api/pipelines.rb
+++ b/lib/api/pipelines.rb
@@ -89,11 +89,11 @@ module API
requires :pipeline_id, type: Integer, desc: 'The pipeline ID'
end
delete ':id/pipelines/:pipeline_id' do
- authorize! :admin_pipeline, user_project
+ authorize! :destroy_pipeline, user_project
- AuditEventService.new(current_user, user_project).security_event
-
- destroy_conditionally!(pipeline)
+ destroy_conditionally!(pipeline) do
+ ::Ci::DestroyPipelineService.new(user_project, current_user).execute(pipeline)
+ end
end
desc 'Retry builds in the pipeline' do