diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-04-26 08:35:19 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-04-26 08:35:19 +0000 |
commit | 6b2eb865caccdac326e97951078494c3dff6c46e (patch) | |
tree | d15262267436edb18a3608f9f18695cf7b73024a | |
parent | 928e45e7d3ac34d4b98bf0d8d57ca6c33e1e924f (diff) | |
parent | d3ea3940c014f8ca37cbb8711be0b53f6e645f81 (diff) | |
download | gitlab-ce-6b2eb865caccdac326e97951078494c3dff6c46e.tar.gz |
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
-rw-r--r-- | changelogs/unreleased/performance-gb-improve-pipeline-creation-service.yml | 5 | ||||
-rw-r--r-- | lib/gitlab/ci/pipeline/chain/populate.rb | 6 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb | 9 |
3 files changed, 8 insertions, 12 deletions
diff --git a/changelogs/unreleased/performance-gb-improve-pipeline-creation-service.yml b/changelogs/unreleased/performance-gb-improve-pipeline-creation-service.yml new file mode 100644 index 00000000000..bd308f37bec --- /dev/null +++ b/changelogs/unreleased/performance-gb-improve-pipeline-creation-service.yml @@ -0,0 +1,5 @@ +--- +title: Improve performance of a service responsible for creating a pipeline +merge_request: 18582 +author: +type: performance diff --git a/lib/gitlab/ci/pipeline/chain/populate.rb b/lib/gitlab/ci/pipeline/chain/populate.rb index d299a5677de..69b8a8fc68f 100644 --- a/lib/gitlab/ci/pipeline/chain/populate.rb +++ b/lib/gitlab/ci/pipeline/chain/populate.rb @@ -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? diff --git a/spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb index 8312fa47cfa..4d7d6951a51 100644 --- a/spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/chain/populate_spec.rb @@ -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 |