Reveert build_relations and simply add a line for creating iid
This commit is contained in:
parent
b02b2602c1
commit
e8ecae7e0b
2 changed files with 10 additions and 16 deletions
|
@ -8,7 +8,13 @@ module Gitlab
|
||||||
PopulateError = Class.new(StandardError)
|
PopulateError = Class.new(StandardError)
|
||||||
|
|
||||||
def perform!
|
def perform!
|
||||||
build_relations
|
# Allocate next IID. This operation must be outside of transactions of pipeline creations.
|
||||||
|
pipeline.ensure_project_iid!
|
||||||
|
|
||||||
|
##
|
||||||
|
# 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.
|
||||||
|
@ -31,18 +37,6 @@ 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
|
||||||
|
|
|
@ -140,10 +140,10 @@ describe Gitlab::Ci::Pipeline::Chain::Populate do
|
||||||
expect { step.perform! }.to raise_error(ActiveRecord::RecordNotSaved)
|
expect { step.perform! }.to raise_error(ActiveRecord::RecordNotSaved)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not waste pipeline iid' do
|
it 'wastes pipeline iid' do
|
||||||
step.perform rescue nil
|
expect { step.perform! }.to raise_error
|
||||||
|
|
||||||
expect(InternalId.ci_pipelines.where(project_id: project.id).exists?).to be_falsy
|
expect(InternalId.ci_pipelines.where(project_id: project.id).exists?).to be_truthy
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue