summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2018-11-07 13:48:29 +0000
committerGrzegorz Bizon <grzegorz@gitlab.com>2018-11-07 13:48:29 +0000
commite60e591fca3dd720c9a8b3e767d7b1b9f4560967 (patch)
tree429c65cb68f5212691989ef7d10131b873239352 /lib
parent0cd22a382ef390cda6dab001ab5e4738dd25b3a5 (diff)
parentd5919aeb1f751fd9d91cd051c0c14bc6e7bc3d63 (diff)
downloadgitlab-ce-e60e591fca3dd720c9a8b3e767d7b1b9f4560967.tar.gz
Merge branch 'touchup-ci-normalizer' into 'master'
Touchup Normalizer implementation See merge request gitlab-org/gitlab-ce!22872
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/ci/config/normalizer.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/gitlab/ci/config/normalizer.rb b/lib/gitlab/ci/config/normalizer.rb
index 969ae093e8b..b7743bd2090 100644
--- a/lib/gitlab/ci/config/normalizer.rb
+++ b/lib/gitlab/ci/config/normalizer.rb
@@ -9,14 +9,16 @@ module Gitlab
end
def normalize_jobs
- extract_parallelized_jobs
+ extract_parallelized_jobs!
+ return @jobs_config if @parallelized_jobs.empty?
+
parallelized_config = parallelize_jobs
parallelize_dependencies(parallelized_config)
end
private
- def extract_parallelized_jobs
+ def extract_parallelized_jobs!
@parallelized_jobs = {}
@jobs_config.each do |job_name, config|
@@ -41,8 +43,8 @@ module Gitlab
end
def parallelize_dependencies(parallelized_config)
+ parallelized_job_names = @parallelized_jobs.keys.map(&:to_s)
parallelized_config.each_with_object({}) do |(job_name, config), hash|
- parallelized_job_names = @parallelized_jobs.keys.map(&:to_s)
if config[:dependencies] && (intersection = config[:dependencies] & parallelized_job_names).any?
deps = intersection.map { |dep| @parallelized_jobs[dep.to_sym].map(&:first) }.flatten
hash[job_name] = config.merge(dependencies: deps)