diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-03-22 14:36:21 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-03-22 14:36:21 +0100 |
commit | b9e329769e4bcc688133a763ea85318abb88aaaa (patch) | |
tree | 949be75aaf8e6a54651e69474de531af1a5038a9 /lib | |
parent | 109ecf6f07a55b2dbd4a4e729ffad72ef7c24643 (diff) | |
download | gitlab-ce-b9e329769e4bcc688133a763ea85318abb88aaaa.tar.gz |
Add specs for pipeline chain that builds stages and jobs
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/ci/pipeline/chain/populate.rb | 10 | ||||
-rw-r--r-- | lib/gitlab/ci/pipeline/seed/stage.rb | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/lib/gitlab/ci/pipeline/chain/populate.rb b/lib/gitlab/ci/pipeline/chain/populate.rb index 5c261ddd2a9..b2b00c8cb4b 100644 --- a/lib/gitlab/ci/pipeline/chain/populate.rb +++ b/lib/gitlab/ci/pipeline/chain/populate.rb @@ -16,10 +16,14 @@ module Gitlab ## # Populate pipeline with all stages and builds from pipeline seeds. # - pipeline.stage_seeds.each do |seed| - seed.user = current_user + pipeline.stage_seeds.each do |stage| + stage.user = current_user - pipeline.stages << seed.to_resource + pipeline.stages << stage.to_resource + + stage.seeds.each do |build| + pipeline.builds << build.to_resource + end end if pipeline.stages.none? diff --git a/lib/gitlab/ci/pipeline/seed/stage.rb b/lib/gitlab/ci/pipeline/seed/stage.rb index 1b4a5004c53..323629b6e48 100644 --- a/lib/gitlab/ci/pipeline/seed/stage.rb +++ b/lib/gitlab/ci/pipeline/seed/stage.rb @@ -33,18 +33,14 @@ module Gitlab end end - # TODO specs - # def included? seeds.any? end def to_resource - @stage ||= ::Ci::Stage.new(attributes).tap do |stage| - @seeds.each do |seed| - next unless seed.included? - - stage.builds << seed.to_resource + strong_memoize(:stage) do + ::Ci::Stage.new(attributes).tap do |stage| + seeds.each { |seed| stage.builds << seed.to_resource } end end end |