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
1
Merge Requests
1
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
nexedi
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
Show 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
...
@@ -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
...
...
lib/gitlab/ci/config/normalizer.rb
View file @
56a08d23
...
@@ -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
...
...
lib/gitlab/ci/yaml_processor.rb
View file @
56a08d23
...
@@ -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
...
...
spec/lib/gitlab/ci/yaml_processor_spec.rb
View file @
56a08d23
...
@@ -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 job
s
'
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
...
...
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