diff options
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 |