Commit 56a08d23 authored by Matija Čupić's avatar Matija Čupić

Parallelize jobs in Gitlab::Ci::YamlProcessor

parent 3c8dd4cc
...@@ -29,8 +29,6 @@ module Gitlab ...@@ -29,8 +29,6 @@ module Gitlab
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
def compose!(deps = nil) def compose!(deps = nil)
super do super do
@config = Ci::Config::Normalizer.normalize_jobs(@config)
@config.each do |name, config| @config.each do |name, config|
node = hidden?(name) ? Entry::Hidden : Entry::Job node = hidden?(name) ? Entry::Hidden : Entry::Job
......
...@@ -7,11 +7,11 @@ module Gitlab ...@@ -7,11 +7,11 @@ module Gitlab
parallelized_jobs = {} parallelized_jobs = {}
parallelized_config = jobs_config.map do |name, config| parallelized_config = jobs_config.map do |name, config|
if config&.[](:parallel) if config[:parallel]
total = config[:parallel] total = config[:parallel]
names = parallelize_job_names(name, total) names = parallelize_job_names(name, total)
parallelized_jobs[name] = names parallelized_jobs[name] = names
Hash[names.collect { |job_name| [job_name.to_sym, config] }] Hash[names.collect { |job_name| [job_name.to_sym, config.merge(name: job_name)] }]
else else
{ name => config } { name => config }
end end
......
...@@ -103,7 +103,7 @@ module Gitlab ...@@ -103,7 +103,7 @@ module Gitlab
## ##
# Jobs # Jobs
# #
@jobs = @ci_config.jobs @jobs = Ci::Config::Normalizer.normalize_jobs(@ci_config.jobs)
@jobs.each do |name, job| @jobs.each do |name, job|
# logical validation for job # logical validation for job
......
...@@ -136,19 +136,6 @@ module Gitlab ...@@ -136,19 +136,6 @@ module Gitlab
end end
end end
end end
describe 'parallel entry' do
context 'when parallel is defined' do
let(:config) do
YAML.dump(rspec: { script: 'rspec',
parallel: 2 })
end
it 'has the attributes' do
expect(subject[:options][:parallel]).to eq 2
end
end
end
end end
describe '#stages_attributes' do describe '#stages_attributes' do
...@@ -667,12 +654,12 @@ module Gitlab ...@@ -667,12 +654,12 @@ module Gitlab
parallel: parallel }) parallel: parallel })
end end
it 'returns parallelized job' do it 'returns parallelized jobs' do
config_processor = Gitlab::Ci::YamlProcessor.new(config) config_processor = Gitlab::Ci::YamlProcessor.new(config)
builds = config_processor.stage_builds_attributes("test") builds = config_processor.stage_builds_attributes('test')
expect(builds.size).to eq(1) expect(builds.size).to eq(5)
expect(builds.first[:options][:parallel]).to eq(parallel) expect(builds.map { |build| build[:options] }).to all(include(parallel: parallel))
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment