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
d9b56bc1
Commit
d9b56bc1
authored
Oct 26, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add parallel keyword to CI config
parent
e997b22d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
7 deletions
+40
-7
lib/gitlab/ci/config/entry/job.rb
lib/gitlab/ci/config/entry/job.rb
+9
-5
spec/lib/gitlab/ci/config/entry/job_spec.rb
spec/lib/gitlab/ci/config/entry/job_spec.rb
+31
-2
No files found.
lib/gitlab/ci/config/entry/job.rb
View file @
d9b56bc1
...
@@ -12,7 +12,7 @@ module Gitlab
...
@@ -12,7 +12,7 @@ module Gitlab
ALLOWED_KEYS
=
%i[tags script only except type image services
ALLOWED_KEYS
=
%i[tags script only except type image services
allow_failure type stage when start_in artifacts cache
allow_failure type stage when start_in artifacts cache
dependencies before_script after_script variables
dependencies before_script after_script variables
environment coverage retry extends]
.
freeze
environment coverage retry
parallel
extends]
.
freeze
validations
do
validations
do
validates
:config
,
allowed_keys:
ALLOWED_KEYS
validates
:config
,
allowed_keys:
ALLOWED_KEYS
...
@@ -27,6 +27,8 @@ module Gitlab
...
@@ -27,6 +27,8 @@ module Gitlab
validates
:retry
,
numericality:
{
only_integer:
true
,
validates
:retry
,
numericality:
{
only_integer:
true
,
greater_than_or_equal_to:
0
,
greater_than_or_equal_to:
0
,
less_than_or_equal_to:
2
}
less_than_or_equal_to:
2
}
validates
:parallel
,
numericality:
{
only_integer:
true
,
greater_than_or_equal_to:
1
}
validates
:when
,
validates
:when
,
inclusion:
{
in:
%w[on_success on_failure always manual delayed]
,
inclusion:
{
in:
%w[on_success on_failure always manual delayed]
,
message:
'should be on_success, on_failure, '
\
message:
'should be on_success, on_failure, '
\
...
@@ -77,17 +79,18 @@ module Gitlab
...
@@ -77,17 +79,18 @@ module Gitlab
description:
'Artifacts configuration for this job.'
description:
'Artifacts configuration for this job.'
entry
:environment
,
Entry
::
Environment
,
entry
:environment
,
Entry
::
Environment
,
description:
'Environment configuration for this job.'
description:
'Environment configuration for this job.'
entry
:coverage
,
Entry
::
Coverage
,
entry
:coverage
,
Entry
::
Coverage
,
description:
'Coverage configuration for this job.'
description:
'Coverage configuration for this job.'
helpers
:before_script
,
:script
,
:stage
,
:type
,
:after_script
,
helpers
:before_script
,
:script
,
:stage
,
:type
,
:after_script
,
:cache
,
:image
,
:services
,
:only
,
:except
,
:variables
,
:cache
,
:image
,
:services
,
:only
,
:except
,
:variables
,
:artifacts
,
:commands
,
:environment
,
:coverage
,
:retry
:artifacts
,
:commands
,
:environment
,
:coverage
,
:retry
,
:parallel
attributes
:script
,
:tags
,
:allow_failure
,
:when
,
:dependencies
,
attributes
:script
,
:tags
,
:allow_failure
,
:when
,
:dependencies
,
:retry
,
:extends
,
:start_in
:retry
,
:
parallel
,
:
extends
,
:start_in
def
compose!
(
deps
=
nil
)
def
compose!
(
deps
=
nil
)
super
do
super
do
...
@@ -156,6 +159,7 @@ module Gitlab
...
@@ -156,6 +159,7 @@ module Gitlab
environment_name:
environment_defined?
?
environment_value
[
:name
]
:
nil
,
environment_name:
environment_defined?
?
environment_value
[
:name
]
:
nil
,
coverage:
coverage_defined?
?
coverage_value
:
nil
,
coverage:
coverage_defined?
?
coverage_value
:
nil
,
retry:
retry_defined?
?
retry_value
.
to_i
:
nil
,
retry:
retry_defined?
?
retry_value
.
to_i
:
nil
,
parallel:
parallel_defined?
?
parallel_value
.
to_i
:
nil
,
artifacts:
artifacts_value
,
artifacts:
artifacts_value
,
after_script:
after_script_value
,
after_script:
after_script_value
,
ignore:
ignored?
}
ignore:
ignored?
}
...
...
spec/lib/gitlab/ci/config/entry/job_spec.rb
View file @
d9b56bc1
require
'fast_spec_helper'
require
'spec_helper'
require_dependency
'active_model'
describe
Gitlab
::
Ci
::
Config
::
Entry
::
Job
do
describe
Gitlab
::
Ci
::
Config
::
Entry
::
Job
do
let
(
:entry
)
{
described_class
.
new
(
config
,
name: :rspec
)
}
let
(
:entry
)
{
described_class
.
new
(
config
,
name: :rspec
)
}
...
@@ -138,6 +137,36 @@ describe Gitlab::Ci::Config::Entry::Job do
...
@@ -138,6 +137,36 @@ describe Gitlab::Ci::Config::Entry::Job do
end
end
end
end
context
'when parallel value is not correct'
do
context
'when it is not a numeric value'
do
let
(
:config
)
{
{
parallel:
true
}
}
it
'returns error about invalid type'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
).
to
include
'job parallel is not a number'
end
end
context
'when it is lower than one'
do
let
(
:config
)
{
{
parallel:
0
}
}
it
'returns error about value too low'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
)
.
to
include
'job parallel must be greater than or equal to 1'
end
end
context
'when it is not an integer'
do
let
(
:config
)
{
{
parallel:
1.5
}
}
it
'returns error about wrong value'
do
expect
(
entry
).
not_to
be_valid
expect
(
entry
.
errors
).
to
include
'job parallel must be an integer'
end
end
end
context
'when delayed job'
do
context
'when delayed job'
do
context
'when start_in is specified'
do
context
'when start_in is specified'
do
let
(
:config
)
{
{
script:
'echo'
,
when:
'delayed'
,
start_in:
'1 day'
}
}
let
(
:config
)
{
{
script:
'echo'
,
when:
'delayed'
,
start_in:
'1 day'
}
}
...
...
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