diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-14 16:19:29 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-14 16:19:29 +0200 |
commit | 006b65098806fde2a467d9a79347d2978c992e89 (patch) | |
tree | 344377e66de454b7be77f775cd37fcf41e0f6bc0 /lib/api/builds.rb | |
parent | dc41a933f4f9a79e7160e38f248d33d7beb99bb6 (diff) | |
parent | d4cd6dcaa024f8eca9089e67fb9b97022696d3e0 (diff) | |
download | gitlab-ce-006b65098806fde2a467d9a79347d2978c992e89.tar.gz |
Merge remote-tracking branch 'origin/master' into environments-and-deployments
# Conflicts:
# db/schema.rb
Diffstat (limited to 'lib/api/builds.rb')
-rw-r--r-- | lib/api/builds.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/api/builds.rb b/lib/api/builds.rb index 6bf59afab53..979328efe0e 100644 --- a/lib/api/builds.rb +++ b/lib/api/builds.rb @@ -166,6 +166,26 @@ module API present build, with: Entities::Build, user_can_download_artifacts: can?(current_user, :download_build_artifacts, user_project) end + + # Keep the artifacts to prevent them from being deleted + # + # Parameters: + # id (required) - the id of a project + # build_id (required) - The ID of a build + # Example Request: + # POST /projects/:id/builds/:build_id/artifacts/keep + post ':id/builds/:build_id/artifacts/keep' do + authorize_update_builds! + + build = get_build(params[:build_id]) + return not_found!(build) unless build && build.artifacts? + + build.keep_artifacts! + + status 200 + present build, with: Entities::Build, + user_can_download_artifacts: can?(current_user, :read_build, user_project) + end end helpers do |