Commit 59e1e971 authored by Shinya Maeda's avatar Shinya Maeda

Add build_relations method in Chain::Populate

parent 09122f93
...@@ -6,9 +6,6 @@ module Gitlab ...@@ -6,9 +6,6 @@ module Gitlab
include Chain::Helpers include Chain::Helpers
def perform! def perform!
# Allocate next IID outside of transaction
pipeline.ensure_project_iid!
::Ci::Pipeline.transaction do ::Ci::Pipeline.transaction do
pipeline.save! pipeline.save!
......
...@@ -8,10 +8,7 @@ module Gitlab ...@@ -8,10 +8,7 @@ module Gitlab
PopulateError = Class.new(StandardError) PopulateError = Class.new(StandardError)
def perform! def perform!
## build_relations
# Populate pipeline with block argument of CreatePipelineService#execute.
#
@command.seeds_block&.call(pipeline)
## ##
# Populate pipeline with all stages, and stages with builds. # Populate pipeline with all stages, and stages with builds.
...@@ -34,6 +31,18 @@ module Gitlab ...@@ -34,6 +31,18 @@ module Gitlab
def break? def break?
pipeline.errors.any? pipeline.errors.any?
end end
private
def build_relations
##
# Populate pipeline with block argument of CreatePipelineService#execute.
#
@command.seeds_block&.call(pipeline)
# Allocate next IID. This operation must be outside of transactions of pipeline creations.
pipeline.ensure_project_iid!
end
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment