diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-05-30 13:48:05 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-05-30 13:48:05 +0300 |
commit | 1f1f5707244bcf4e69ef0fbe01f93e59386d5087 (patch) | |
tree | 4dac972bc05a830bdf06bc6412bab085111c6fdc /lib/ci | |
parent | ff61e2b776badef7cd614e697a7eac20c63534eb (diff) |
Implement CI/CD config attributes for persisted stages
Diffstat (limited to 'lib/ci')
-rw-r--r-- | lib/ci/gitlab_ci_yaml_processor.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/ci/gitlab_ci_yaml_processor.rb b/lib/ci/gitlab_ci_yaml_processor.rb index b06474cda7f..17a3cdc714c 100644 --- a/lib/ci/gitlab_ci_yaml_processor.rb +++ b/lib/ci/gitlab_ci_yaml_processor.rb @@ -50,10 +50,20 @@ module Ci end end + def stages_for_ref(ref, tag = false, trigger_request = nil) + stages = @stages.map do |stage| + builds = builds_for_stage_and_ref(stage, ref, tag, trigger_request) + + { name: stage, builds_attributes: builds.to_a } if builds.any? + end + + stages.compact.sort_by { |stage| @stages.index(stage[:name]) } + end + def build_attributes(name) job = @jobs[name.to_sym] || {} - { - stage_idx: @stages.index(job[:stage]), + + { stage_idx: @stages.index(job[:stage]), stage: job[:stage], commands: job[:commands], tag_list: job[:tags] || [], |