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
Boxiang Sun
gitlab-ce
Commits
44b740f9
Commit
44b740f9
authored
Oct 26, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement POC for job parallelization
parent
d9b56bc1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-1
lib/gitlab/ci/pipeline/seed/build.rb
lib/gitlab/ci/pipeline/seed/build.rb
+23
-1
lib/gitlab/ci/yaml_processor.rb
lib/gitlab/ci/yaml_processor.rb
+1
-0
No files found.
lib/gitlab/ci/pipeline/seed/build.rb
View file @
44b740f9
...
@@ -24,6 +24,24 @@ module Gitlab
...
@@ -24,6 +24,24 @@ module Gitlab
end
end
end
end
def
parallelized?
@attributes
[
:options
].
include?
(
:parallel
)
end
def
parallelize_build
builds
=
[]
total
=
@attributes
[
:options
][
:parallel
]
total
.
times
do
|
i
|
build
=
::
Ci
::
Build
.
new
(
attributes
.
merge
(
options:
{
variables:
{
CI_NODE_INDEX
:
i
+
1
,
CI_NODE_TOTAL
:
total
}
}))
build
.
name
=
build
.
name
+
"_
#{
i
+
1
}
/
#{
total
}
"
builds
<<
build
end
builds
end
def
attributes
def
attributes
@attributes
.
merge
(
@attributes
.
merge
(
pipeline:
@pipeline
,
pipeline:
@pipeline
,
...
@@ -38,6 +56,9 @@ module Gitlab
...
@@ -38,6 +56,9 @@ module Gitlab
def
to_resource
def
to_resource
strong_memoize
(
:resource
)
do
strong_memoize
(
:resource
)
do
if
parallelized?
parallelize_build
else
::
Ci
::
Build
.
new
(
attributes
)
::
Ci
::
Build
.
new
(
attributes
)
end
end
end
end
...
@@ -45,4 +66,5 @@ module Gitlab
...
@@ -45,4 +66,5 @@ module Gitlab
end
end
end
end
end
end
end
end
end
lib/gitlab/ci/yaml_processor.rb
View file @
44b740f9
...
@@ -50,6 +50,7 @@ module Gitlab
...
@@ -50,6 +50,7 @@ module Gitlab
after_script:
job
[
:after_script
],
after_script:
job
[
:after_script
],
environment:
job
[
:environment
],
environment:
job
[
:environment
],
retry:
job
[
:retry
],
retry:
job
[
:retry
],
parallel:
job
[
:parallel
],
start_in:
job
[
:start_in
]
start_in:
job
[
:start_in
]
}.
compact
}
}.
compact
}
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