diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-11-08 13:24:37 +0000 |
---|---|---|
committer | Steve Azzopardi <steveazz@outlook.com> | 2018-11-09 08:58:11 +0100 |
commit | 320db975b71a5da023335a5969ca378aef159367 (patch) | |
tree | 2f952799f9cfa2edc005cf4dcc4a25f5a0a4d0f4 | |
parent | e5b5d4a897ae7b4f5875fa3493c465f6d606cd79 (diff) | |
download | gitlab-ce-320db975b71a5da023335a5969ca378aef159367.tar.gz |
Merge branch 'limit-parallel-to-100' into 'master'
Limit parallel to 50
Closes #53711
See merge request gitlab-org/gitlab-ce!22907
-rw-r--r-- | doc/ci/yaml/README.md | 2 | ||||
-rw-r--r-- | lib/gitlab/ci/config/entry/job.rb | 3 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/config/entry/job_spec.rb | 10 |
3 files changed, 13 insertions, 2 deletions
diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index c827faace33..5cca9d86560 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -1510,7 +1510,7 @@ Possible values for `when` are: > [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. 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 sequentially from `job_name 1/N` to `job_name N/N`. diff --git a/lib/gitlab/ci/config/entry/job.rb b/lib/gitlab/ci/config/entry/job.rb index 8e8c979f973..c8cb3248fa7 100644 --- a/lib/gitlab/ci/config/entry/job.rb +++ b/lib/gitlab/ci/config/entry/job.rb @@ -27,7 +27,8 @@ module Gitlab validates :tags, array_of_strings: true validates :allow_failure, boolean: 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, inclusion: { in: %w[on_success on_failure always manual delayed], message: 'should be on_success, on_failure, ' \ diff --git a/spec/lib/gitlab/ci/config/entry/job_spec.rb b/spec/lib/gitlab/ci/config/entry/job_spec.rb index ac9b0c674a5..57d4577a90c 100644 --- a/spec/lib/gitlab/ci/config/entry/job_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/job_spec.rb @@ -118,6 +118,16 @@ describe Gitlab::Ci::Config::Entry::Job do 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 let(:config) { { parallel: 1.5 } } |