diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-06-10 17:11:27 +0200 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-06-13 11:07:23 +0100 |
commit | 6013768fec33e3bf084019d97dbfb7cca78f8e82 (patch) | |
tree | 6d79ea67c7ea8bdae03f0cdfd958b6586b817dd6 /lib/api | |
parent | 7e9273dd946f46b2b2bcc0a751316dc704089a16 (diff) | |
download | gitlab-ce-6013768fec33e3bf084019d97dbfb7cca78f8e82.tar.gz |
Added keep artifacts API endpoint
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/builds.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/api/builds.rb b/lib/api/builds.rb index 0ff8fa74a84..704654e9e8c 100644 --- a/lib/api/builds.rb +++ b/lib/api/builds.rb @@ -166,6 +166,25 @@ 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 to be deleted + # + # Parameters: + # 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 |