Merge branch 'performance/gb/improve-pipeline-creation-service' into 'master'

Improve pipeline creation service performance

Closes #37987

See merge request gitlab-org/gitlab-ce!18582
This commit is contained in:
Kamil Trzciński 2018-04-26 08:35:19 +00:00
commit 6b2eb865ca
3 changed files with 8 additions and 12 deletions

View File

@ -0,0 +1,5 @@
---
title: Improve performance of a service responsible for creating a pipeline
merge_request: 18582
author:
type: performance

View File

@ -14,14 +14,10 @@ module Gitlab
@command.seeds_block&.call(pipeline)
##
# Populate pipeline with all stages and builds from pipeline seeds.
# Populate pipeline with all stages, and stages with builds.
#
pipeline.stage_seeds.each do |stage|
pipeline.stages << stage.to_resource
stage.seeds.each do |build|
pipeline.builds << build.to_resource
end
end
if pipeline.stages.none?

View File

@ -35,11 +35,6 @@ describe Gitlab::Ci::Pipeline::Chain::Populate do
it 'populates pipeline with stages' do
expect(pipeline.stages).to be_one
expect(pipeline.stages.first).not_to be_persisted
end
it 'populates pipeline with builds' do
expect(pipeline.builds).to be_one
expect(pipeline.builds.first).not_to be_persisted
expect(pipeline.stages.first.builds).to be_one
expect(pipeline.stages.first.builds.first).not_to be_persisted
end
@ -151,8 +146,8 @@ describe Gitlab::Ci::Pipeline::Chain::Populate do
step.perform!
expect(pipeline.stages.size).to eq 1
expect(pipeline.builds.size).to eq 1
expect(pipeline.builds.first.name).to eq 'rspec'
expect(pipeline.stages.first.builds.size).to eq 1
expect(pipeline.stages.first.builds.first.name).to eq 'rspec'
end
end
end