diff options
Diffstat (limited to 'app/workers/ci/initialize_pipelines_iid_sequence_worker.rb')
-rw-r--r-- | app/workers/ci/initialize_pipelines_iid_sequence_worker.rb | 19 |
1 files changed, 19 insertions, 0 deletions
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 |