From 5b45cd246373f18bf678dbdecad589733cfec8b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Mon, 12 Nov 2018 16:27:28 +0100 Subject: Implement MVC for Pipeline deletion API --- lib/api/pipelines.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/api/pipelines.rb') diff --git a/lib/api/pipelines.rb b/lib/api/pipelines.rb index 1cfb982c04b..d4bd4e71343 100644 --- a/lib/api/pipelines.rb +++ b/lib/api/pipelines.rb @@ -81,6 +81,21 @@ module API present pipeline, with: Entities::Pipeline end + desc 'Deletes a pipeline' do + detail 'This feature was introduced in GitLab 11.6' + http_codes [[204, 'Pipeline was deleted'], [403, 'Forbidden']] + end + params do + requires :pipeline_id, type: Integer, desc: 'The pipeline ID' + end + delete ':id/pipelines/:pipeline_id' do + authorize! :admin_pipeline, user_project + + AuditEventService.new(current_user, user_project).security_event + + destroy_conditionally!(pipeline) + end + desc 'Retry builds in the pipeline' do detail 'This feature was introduced in GitLab 8.11.' success Entities::Pipeline -- cgit v1.2.1