diff options
author | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2021-01-20 13:34:23 -0600 |
commit | 6438df3a1e0fb944485cebf07976160184697d72 (patch) | |
tree | 00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /lib/api/jobs.rb | |
parent | 42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff) | |
download | gitlab-ce-6438df3a1e0fb944485cebf07976160184697d72.tar.gz |
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
Diffstat (limited to 'lib/api/jobs.rb')
-rw-r--r-- | lib/api/jobs.rb | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/api/jobs.rb b/lib/api/jobs.rb index 44751b3d76c..e14a4a5e680 100644 --- a/lib/api/jobs.rb +++ b/lib/api/jobs.rb @@ -138,25 +138,32 @@ module API present build, with: Entities::Ci::Job end - desc 'Trigger a actionable job (manual, delayed, etc)' do - success Entities::Ci::Job + desc 'Trigger an actionable job (manual, delayed, etc)' do + success Entities::Ci::JobBasic detail 'This feature was added in GitLab 8.11' end params do requires :job_id, type: Integer, desc: 'The ID of a Job' end + post ":id/jobs/:job_id/play" do authorize_read_builds! - build = find_build!(params[:job_id]) + job = find_job!(params[:job_id]) - authorize!(:update_build, build) - bad_request!("Unplayable Job") unless build.playable? + authorize!(:play_job, job) - build.play(current_user) + bad_request!("Unplayable Job") unless job.playable? + + job.play(current_user) status 200 - present build, with: Entities::Ci::Job + + if job.is_a?(::Ci::Build) + present job, with: Entities::Ci::Job + else + present job, with: Entities::Ci::Bridge + end end end |