diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-05-31 15:13:40 +0200 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-05-31 15:13:40 +0200 |
commit | c72e21fd9764845a107005562ff8ce1c06cac431 (patch) | |
tree | 1acd707d049036bd532046b91e5f25d55633744e /lib/ci | |
parent | c881425b665b9c0b022dc2e213486aecc320ec7e (diff) | |
download | gitlab-ce-c72e21fd9764845a107005562ff8ce1c06cac431.tar.gz |
Return stage seeds object from YAML processor
Diffstat (limited to 'lib/ci')
-rw-r--r-- | lib/ci/gitlab_ci_yaml_processor.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb index 5e6c3d029c6..4b0e87a945b 100644 --- a/lib/ci/gitlab_ci_yaml_processor.rb +++ b/lib/ci/gitlab_ci_yaml_processor.rb @@ -50,14 +50,14 @@ module Ci end end - def stages_for_ref(ref, tag = false, trigger_request = nil) - stages = @stages.uniq.map do |stage| - builds = builds_for_stage_and_ref(stage, ref, tag, trigger_request) + def stage_seeds(ref:, tag: false, trigger: nil) + Gitlab::Ci::Stage::Seeds.new.tap do |seeds| + @stages.uniq.each do |stage| + builds = builds_for_stage_and_ref(stage, ref, tag, trigger) - { name: stage, builds_attributes: builds.to_a } if builds.any? + seeds.append_stage(stage, builds) if builds.any? + end end - - stages.compact.sort_by { |stage| @stages.index(stage[:name]) } end def build_attributes(name) |