diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /lib/api/jobs.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'lib/api/jobs.rb')
-rw-r--r-- | lib/api/jobs.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/api/jobs.rb b/lib/api/jobs.rb index 59f0dbe8a9b..61a7fc107ef 100644 --- a/lib/api/jobs.rb +++ b/lib/api/jobs.rb @@ -70,6 +70,32 @@ module API end # rubocop: enable CodeReuse/ActiveRecord + desc 'Get pipeline bridge jobs' do + success Entities::Bridge + end + params do + requires :pipeline_id, type: Integer, desc: 'The pipeline ID' + use :optional_scope + use :pagination + end + # rubocop: disable CodeReuse/ActiveRecord + get ':id/pipelines/:pipeline_id/bridges' do + authorize!(:read_build, user_project) + pipeline = user_project.ci_pipelines.find(params[:pipeline_id]) + authorize!(:read_pipeline, pipeline) + + bridges = pipeline.bridges + bridges = filter_builds(bridges, params[:scope]) + bridges = bridges.preload( + :metadata, + downstream_pipeline: [project: [:route, { namespace: :route }]], + project: [:namespace] + ) + + present paginate(bridges), with: Entities::Bridge + end + # rubocop: enable CodeReuse/ActiveRecord + desc 'Get a specific job of a project' do success Entities::Job end |