Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
56a08d23
Commit
56a08d23
authored
Nov 01, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parallelize jobs in Gitlab::Ci::YamlProcessor
parent
3c8dd4cc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
22 deletions
+7
-22
lib/gitlab/ci/config/entry/jobs.rb
lib/gitlab/ci/config/entry/jobs.rb
+0
-2
lib/gitlab/ci/config/normalizer.rb
lib/gitlab/ci/config/normalizer.rb
+2
-2
lib/gitlab/ci/yaml_processor.rb
lib/gitlab/ci/yaml_processor.rb
+1
-1
spec/lib/gitlab/ci/yaml_processor_spec.rb
spec/lib/gitlab/ci/yaml_processor_spec.rb
+4
-17
No files found.
lib/gitlab/ci/config/entry/jobs.rb
View file @
56a08d23
...
...
@@ -29,8 +29,6 @@ module Gitlab
# rubocop: disable CodeReuse/ActiveRecord
def
compose!
(
deps
=
nil
)
super
do
@config
=
Ci
::
Config
::
Normalizer
.
normalize_jobs
(
@config
)
@config
.
each
do
|
name
,
config
|
node
=
hidden?
(
name
)
?
Entry
::
Hidden
:
Entry
::
Job
...
...
lib/gitlab/ci/config/normalizer.rb
View file @
56a08d23
...
...
@@ -7,11 +7,11 @@ module Gitlab
parallelized_jobs
=
{}
parallelized_config
=
jobs_config
.
map
do
|
name
,
config
|
if
config
&
.
[
](
:parallel
)
if
config
[
:parallel
]
total
=
config
[
:parallel
]
names
=
parallelize_job_names
(
name
,
total
)
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
{
name
=>
config
}
end
...
...
lib/gitlab/ci/yaml_processor.rb
View file @
56a08d23
...
...
@@ -103,7 +103,7 @@ module Gitlab
##
# Jobs
#
@jobs
=
@ci_config
.
jobs
@jobs
=
Ci
::
Config
::
Normalizer
.
normalize_jobs
(
@ci_config
.
jobs
)
@jobs
.
each
do
|
name
,
job
|
# logical validation for job
...
...
spec/lib/gitlab/ci/yaml_processor_spec.rb
View file @
56a08d23
...
...
@@ -136,19 +136,6 @@ module Gitlab
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
describe
'#stages_attributes'
do
...
...
@@ -667,12 +654,12 @@ module Gitlab
parallel:
parallel
})
end
it
'returns parallelized job'
do
it
'returns parallelized job
s
'
do
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
.
first
[
:options
][
:parallel
]).
to
eq
(
parallel
)
expect
(
builds
.
size
).
to
eq
(
5
)
expect
(
builds
.
map
{
|
build
|
build
[
:options
]
}).
to
all
(
include
(
parallel:
parallel
)
)
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment