diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/workers/all_queues.yml | 9 | ||||
-rw-r--r-- | app/workers/ci/initialize_pipelines_iid_sequence_worker.rb | 19 |
2 files changed, 28 insertions, 0 deletions
diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index 1664add1ac9..60f233b8289 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -2541,6 +2541,15 @@ :weight: 1 :idempotent: true :tags: [] +- :name: ci_initialize_pipelines_iid_sequence + :worker_name: Ci::InitializePipelinesIidSequenceWorker + :feature_category: :continuous_integration + :has_external_dependencies: false + :urgency: :low + :resource_boundary: :unknown + :weight: 1 + :idempotent: true + :tags: [] - :name: ci_job_artifacts_expire_project_build_artifacts :worker_name: Ci::JobArtifacts::ExpireProjectBuildArtifactsWorker :feature_category: :build_artifacts diff --git a/app/workers/ci/initialize_pipelines_iid_sequence_worker.rb b/app/workers/ci/initialize_pipelines_iid_sequence_worker.rb new file mode 100644 index 00000000000..95b58814e08 --- /dev/null +++ b/app/workers/ci/initialize_pipelines_iid_sequence_worker.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Ci + class InitializePipelinesIidSequenceWorker + include Gitlab::EventStore::Subscriber + + data_consistency :always + feature_category :continuous_integration + idempotent! + + def handle_event(event) + Project.find_by_id(event.data[:project_id]).try do |project| + next if project.internal_ids.ci_pipelines.any? + + ::Ci::Pipeline.track_project_iid!(project, 0) + end + end + end +end |