diff options
author | Grzegorz Bizon <grzegorz.bizon@ntsn.pl> | 2016-02-03 14:12:33 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-02-19 17:24:59 +0100 |
commit | 13f92521c22f63140adbf933737e0c5dc988a8d4 (patch) | |
tree | 64e14a973a4ac7499dfbe5d9977c8c0326ff97d9 /lib/api/builds.rb | |
parent | a2eac4684c0562df06d28617f81e2494e673bbb4 (diff) | |
download | gitlab-ce-13f92521c22f63140adbf933737e0c5dc988a8d4.tar.gz |
Move build eraseable API to proper API context
Diffstat (limited to 'lib/api/builds.rb')
-rw-r--r-- | lib/api/builds.rb | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/api/builds.rb b/lib/api/builds.rb index a8bd3842ce4..06ec03fc4e0 100644 --- a/lib/api/builds.rb +++ b/lib/api/builds.rb @@ -115,13 +115,33 @@ module API authorize_update_builds! build = get_build(params[:build_id]) - return forbidden!('Build is not retryable') unless build && build.retryable? + return not_found!(build) unless build + return forbidden!('Build is not retryable') unless build.retryable? build = Ci::Build.retry(build) present build, with: Entities::Build, user_can_download_artifacts: can?(current_user, :read_build, user_project) end + + # Erase build (remove artifacts and build trace) + # + # Parameters: + # id (required) - the id of a project + # build_id (required) - the id of a build + # example Request: + # delete /projects/:id/build/:build_id/content + delete ':id/builds/:build_id/content' do + authorize_manage_builds! + + build = get_build(params[:build_id]) + return not_found!(build) unless build + return forbidden!('Build is not eraseable!') unless build.eraseable? + + build.erase! + present build, with: Entities::Build, + user_can_download_artifacts: can?(current_user, :download_build_artifacts, user_project) + end end helpers do |