Merge branch '55628-artifacts-from-a-job-defined-after-a-parallel-job-are-not-downloaded' into 'master'

Resolve "Artifacts from a job defined after a `parallel` job are NOT downloaded"

Closes #55628

See merge request gitlab-org/gitlab-ce!24273
This commit is contained in:
Grzegorz Bizon 2019-01-10 07:50:19 +00:00
commit 5f258b0cea
3 changed files with 27 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
title: Handle regular job dependencies next to parallelized job dependencies.
merge_request: 24273
author:
type: fixed

View File

@ -46,7 +46,8 @@ module Gitlab
parallelized_job_names = @parallelized_jobs.keys.map(&:to_s)
parallelized_config.each_with_object({}) do |(job_name, config), hash|
if config[:dependencies] && (intersection = config[:dependencies] & parallelized_job_names).any?
deps = intersection.map { |dep| @parallelized_jobs[dep.to_sym].map(&:first) }.flatten
parallelized_deps = intersection.map { |dep| @parallelized_jobs[dep.to_sym].map(&:first) }.flatten
deps = config[:dependencies] - intersection + parallelized_deps
hash[job_name] = config.merge(dependencies: deps)
else
hash[job_name] = config

View File

@ -62,5 +62,25 @@ describe Gitlab::Ci::Config::Normalizer do
expect(subject[:other_job][:dependencies]).not_to include(job_name)
end
end
context 'when there are dependencies which are both parallelized and not' do
let(:config) do
{
job_name => job_config,
other_job: { script: 'echo 1' },
final_job: { script: 'echo 1', dependencies: [job_name.to_s, "other_job"] }
}
end
it 'parallelizes dependencies' do
job_names = ["rspec 1/5", "rspec 2/5", "rspec 3/5", "rspec 4/5", "rspec 5/5"]
expect(subject[:final_job][:dependencies]).to include(*job_names)
end
it 'includes the regular job in dependencies' do
expect(subject[:final_job][:dependencies]).to include('other_job')
end
end
end
end