summaryrefslogtreecommitdiff
path: root/app/workers/expire_build_artifacts_worker.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-06-15 20:14:25 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-06-15 20:14:25 +0200
commitd8670e114af1e21c48878afe8af16cc5628861fa (patch)
treec84b3fb5398b9629491ab30549a9cbd89b3495c3 /app/workers/expire_build_artifacts_worker.rb
parent2d495fce529cc3ac15f7096ddf9962db0fbd1e23 (diff)
parent32a5ff70d771e7bff4e5c7b42fe95a966fa47a96 (diff)
downloadgitlab-ce-d8670e114af1e21c48878afe8af16cc5628861fa.tar.gz
Merge branch 'master' into fix/status-of-pipeline-without-buildsfix/status-of-pipeline-without-builds
* master: (198 commits) Set inverse_of for Project/Services relation Fix admin hooks spec Prevent default disabled buttons and links. Add index on `requested_at` to the `members` table Rearrange order of tabs Fix admin active tab tests Show created_at in table column Nest li elements directly under ul Move builds tab to admin overview Add monitoring link with subtabs Add sub links to overview Add counter for abuse reports Remove admin layout-nav counters Move admin nav to horizontal layout nav Eager load project relations in IssueParser Use validate and required for environment and project Award Emoji can't be awarded on system notes backend Get rid of Gitlab::ShellEnv Update CHANGELOG. Fix project star tooltip on the fly. ... Conflicts: app/services/ci/create_builds_service.rb
Diffstat (limited to 'app/workers/expire_build_artifacts_worker.rb')
-rw-r--r--app/workers/expire_build_artifacts_worker.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/workers/expire_build_artifacts_worker.rb b/app/workers/expire_build_artifacts_worker.rb
new file mode 100644
index 00000000000..c64ea108d52
--- /dev/null
+++ b/app/workers/expire_build_artifacts_worker.rb
@@ -0,0 +1,13 @@
+class ExpireBuildArtifactsWorker
+ include Sidekiq::Worker
+
+ def perform
+ Rails.logger.info 'Cleaning old build artifacts'
+
+ builds = Ci::Build.with_expired_artifacts
+ builds.find_each(batch_size: 50).each do |build|
+ Rails.logger.debug "Removing artifacts build #{build.id}..."
+ build.erase_artifacts!
+ end
+ end
+end