提交 2019d195 编写于 作者: G Grzegorz Bizon

Merge branch 'limit-parallel-to-100' into 'master'

Limit parallel to 50

Closes #53711

See merge request gitlab-org/gitlab-ce!22907
...@@ -1510,7 +1510,7 @@ Possible values for `when` are: ...@@ -1510,7 +1510,7 @@ Possible values for `when` are:
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22631) in GitLab 11.5. > [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22631) in GitLab 11.5.
`parallel` allows you to configure how many instances of a job to run in `parallel` allows you to configure how many instances of a job to run in
parallel. This value has to be greater than or equal to two (2). parallel. This value has to be greater than or equal to two (2) and less or equal than 50.
This creates N instances of the same job that run in parallel. They're named This creates N instances of the same job that run in parallel. They're named
sequentially from `job_name 1/N` to `job_name N/N`. sequentially from `job_name 1/N` to `job_name N/N`.
......
...@@ -27,7 +27,8 @@ module Gitlab ...@@ -27,7 +27,8 @@ module Gitlab
validates :tags, array_of_strings: true validates :tags, array_of_strings: true
validates :allow_failure, boolean: true validates :allow_failure, boolean: true
validates :parallel, numericality: { only_integer: true, validates :parallel, numericality: { only_integer: true,
greater_than_or_equal_to: 2 } greater_than_or_equal_to: 2,
less_than_or_equal_to: 50 }
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, ' \
......
...@@ -118,6 +118,16 @@ describe Gitlab::Ci::Config::Entry::Job do ...@@ -118,6 +118,16 @@ describe Gitlab::Ci::Config::Entry::Job do
end end
end end
context 'when it is bigger than 50' do
let(:config) { { parallel: 51 } }
it 'returns error about value too high' do
expect(entry).not_to be_valid
expect(entry.errors)
.to include 'job parallel must be less than or equal to 50'
end
end
context 'when it is not an integer' do context 'when it is not an integer' do
let(:config) { { parallel: 1.5 } } let(:config) { { parallel: 1.5 } }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册