summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-01-11 11:29:53 +0000
committerSean McGivern <sean@mcgivern.me.uk>2018-01-11 11:29:53 +0000
commit06713cb7b07f30eda8f67531387f7cb8801987b1 (patch)
tree69e8f1a35b5c76b28e12271d1e4dd59f749d375f /lib
parent59adc07f00f4f3ea326194d77c31580edfdfb2a4 (diff)
parent7ed08fcd5db058500b3092fd94791e9bd8a29bb7 (diff)
downloadgitlab-ce-06713cb7b07f30eda8f67531387f7cb8801987b1.tar.gz
Merge branch '39214__pipeline_api' into 'master'
Add `pipelines` endpoint to merge requests API Closes #39214 See merge request gitlab-org/gitlab-ce!15454
Diffstat (limited to 'lib')
-rw-r--r--lib/api/merge_requests.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb
index 8f665b39fa8..420aaf1c964 100644
--- a/lib/api/merge_requests.rb
+++ b/lib/api/merge_requests.rb
@@ -24,6 +24,13 @@ module API
.preload(:notes, :author, :assignee, :milestone, :latest_merge_request_diff, :labels, :timelogs)
end
+ def merge_request_pipelines_with_access
+ authorize! :read_pipeline, user_project
+
+ mr = find_merge_request_with_access(params[:merge_request_iid])
+ mr.all_pipelines
+ end
+
params :merge_requests_params do
optional :state, type: String, values: %w[opened closed merged all], default: 'all',
desc: 'Return opened, closed, merged, or all merge requests'
@@ -214,6 +221,15 @@ module API
present merge_request, with: Entities::MergeRequestChanges, current_user: current_user
end
+ desc 'Get the merge request pipelines' do
+ success Entities::PipelineBasic
+ end
+ get ':id/merge_requests/:merge_request_iid/pipelines' do
+ pipelines = merge_request_pipelines_with_access
+
+ present paginate(pipelines), with: Entities::PipelineBasic
+ end
+
desc 'Update a merge request' do
success Entities::MergeRequest
end