Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-03-06 18:56:05 +0300
committerToon Claes <toon@gitlab.com>2017-03-08 01:45:32 +0300
commitf37240067301548a41a6257792d3926b68328e62 (patch)
treed2431c67709859073f3db667fefd8e3f37586637 /lib
parent7f2819b778b055278a7fafe9c782d12d09dbd2ea (diff)
Add GET /projects/:id/pipelines/:pipeline_id/jobs endpoint
Add endpoint to get the jobs scoped to a pipeline.
Diffstat (limited to 'lib')
-rw-r--r--lib/api/jobs.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/api/jobs.rb b/lib/api/jobs.rb
index 33c05e8aa63..af8f4b1e759 100644
--- a/lib/api/jobs.rb
+++ b/lib/api/jobs.rb
@@ -40,6 +40,23 @@ module API
user_can_download_artifacts: can?(current_user, :read_build, user_project)
end
+ desc 'Get pipeline jobs' do
+ success Entities::Job
+ end
+ params do
+ requires :pipeline_id, type: Integer, desc: 'The pipeline ID'
+ use :optional_scope
+ use :pagination
+ end
+ get ':id/pipelines/:pipeline_id/jobs' do
+ pipeline = user_project.pipelines.find(params[:pipeline_id])
+ builds = pipeline.builds
+ builds = filter_builds(builds, params[:scope])
+
+ present paginate(builds), with: Entities::Job,
+ user_can_download_artifacts: can?(current_user, :read_build, user_project)
+ end
+
desc 'Get a specific job of a project' do
success Entities::Job
end