diff options
author | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-08-15 15:58:22 +0200 |
---|---|---|
committer | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-08-18 21:10:52 +0200 |
commit | fffe5c2b577b39be2254525d4320cf396b7ff58b (patch) | |
tree | e3b3965f4877afcf32e37e36fa25646583ea6286 /lib/api/builds.rb | |
parent | 15b441f3678bffd948ccb56b7f978646fd40b853 (diff) | |
download | gitlab-ce-fffe5c2b577b39be2254525d4320cf396b7ff58b.tar.gz |
Add Play endpoints on Builds
Diffstat (limited to 'lib/api/builds.rb')
-rw-r--r-- | lib/api/builds.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/api/builds.rb b/lib/api/builds.rb index be5a3484ec8..2bd3b65acdc 100644 --- a/lib/api/builds.rb +++ b/lib/api/builds.rb @@ -189,6 +189,29 @@ module API present build, with: Entities::Build, user_can_download_artifacts: can?(current_user, :read_build, user_project) end + + desc 'Trigger a manual build' do + success Entities::Build + detail 'This feature was added in GitLab 8.11' + end + params do + requires :build_id, type: Integer, desc: 'The ID of a Build' + end + post ":id/builds/:build_id/play" do + authorize_read_builds! + + build = get_build!(params[:build_id]) + + if build.playable? + build.play(current_user) + + status 200 + present build, with: Entities::Build, + user_can_download_artifacts: can?(current_user, :read_build, user_project) + else + bad_request!("Unplayable Build") + end + end end helpers do |