summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-06-14 13:40:01 +0000
committerRémy Coutable <remy@rymai.me>2016-06-14 13:40:01 +0000
commit95a7fbe97cebdf3e4249a99b6729ffb410398e4f (patch)
tree779bc43340f5819c3f48bc078e3ed5f6ade58a21 /lib/api
parent1c0c5232c2745ecb321db6991f549d8d033a7032 (diff)
parent2b5449b96d1c08eafc3e874f28dd9f85a6b09535 (diff)
downloadgitlab-ce-95a7fbe97cebdf3e4249a99b6729ffb410398e4f.tar.gz
Merge branch 'artifacts-expire-date' into 'master'
Artifacts expire date What do you think @grzesiek? The syntax will be simple: ``` job: artifacts: expire_in: 7d ``` - [x] Implement `expire_in` - [x] Check current design of expiry information with @jschatz1 and @markpundsack - [x] Add tests in GitLab application for a `ExpireBuildArtifactsWorker` and for `ArtifactsController::keep` - [x] Add user documentation how to use `artifacts:expire_in` - [x] Prepare GitLab Runner changes to pass `expire_in`: gitlab-org/gitlab-ci-multi-runner!191 - [x] Fix `timeago` with help of @jschatz1 - [x] Merge latest master after builds view changes @iamphill - [ ] Add Omnibus support for `expire_build_artifacts_worker` cron job - [ ] Add documentation how to configure `expire_build_artifacts_worker` This is based on https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4201. See merge request !4200
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/builds.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/api/builds.rb b/lib/api/builds.rb
index 0ff8fa74a84..645e2dda0b7 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