diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-07 15:10:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-07 15:10:24 +0300 |
commit | e227f482346aa39655cdebb5a59eeef78e1e12b4 (patch) | |
tree | 1b33c8d71e3f3aeae5d7cdcdbf18643512d632b4 /app/workers | |
parent | d51d5adf94ad965af8433ce6f74a81cfef5669e1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/all_queues.yml | 8 | ||||
-rw-r--r-- | app/workers/ci/pipeline_artifacts/expire_artifacts_worker.rb | 25 |
2 files changed, 33 insertions, 0 deletions
diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index 7d1d85ef2b6..94c4da30ed8 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -147,6 +147,14 @@ :weight: 1 :idempotent: :tags: [] +- :name: cronjob:ci_pipeline_artifacts_expire_artifacts + :feature_category: :continuous_integration + :has_external_dependencies: + :urgency: :low + :resource_boundary: :unknown + :weight: 1 + :idempotent: true + :tags: [] - :name: cronjob:ci_platform_metrics_update_cron :feature_category: :continuous_integration :has_external_dependencies: diff --git a/app/workers/ci/pipeline_artifacts/expire_artifacts_worker.rb b/app/workers/ci/pipeline_artifacts/expire_artifacts_worker.rb new file mode 100644 index 00000000000..6a02c980c99 --- /dev/null +++ b/app/workers/ci/pipeline_artifacts/expire_artifacts_worker.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +module Ci + module PipelineArtifacts + class ExpireArtifactsWorker + include ApplicationWorker + # rubocop:disable Scalability/CronWorkerContext + # This worker does not perform work scoped to a context + include CronjobQueue + # rubocop:enable Scalability/CronWorkerContext + + deduplicate :until_executed, including_scheduled: true + idempotent! + feature_category :continuous_integration + + def perform + return unless ::Feature.enabled?(:ci_split_pipeline_artifacts_removal) + + service = ::Ci::PipelineArtifacts::DestroyExpiredArtifactsService.new + artifacts_count = service.execute + log_extra_metadata_on_done(:destroyed_pipeline_artifacts_count, artifacts_count) + end + end + end +end |