diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index 6b17af1394a33c16ce72743a1db99134e262576f..808a23df5544bbd27ccff030c714334c7ce29ca7 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -1147,7 +1147,7 @@ up to the amount of times specified by the `retry` keyword. If `retry` is set to 3, and a job succeeds in a second run, it won't be retried again. `retry` value has to be a positive integer, equal or larger than 0, but -lower than 10. +lower or equal to 2 (two retries maximum, three runs in total). A simple example: diff --git a/lib/gitlab/ci/config/entry/job.rb b/lib/gitlab/ci/config/entry/job.rb index 5f1144894b5d8b13f5cb29445bba14e51b2d7355..32f5c6ab1421606256bd409ab7afdf2813d0f3e9 100644 --- a/lib/gitlab/ci/config/entry/job.rb +++ b/lib/gitlab/ci/config/entry/job.rb @@ -25,7 +25,7 @@ module Gitlab validates :allow_failure, boolean: true validates :retry, numericality: { only_integer: true, greater_than_or_equal_to: 0, - less_than: 10 } + less_than_or_equal_to: 2 } validates :when, inclusion: { in: %w[on_success on_failure always manual], 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 f8ed59a3a44ce419adc068b501f7413024d63c3f..6769f64f95055c6aadfc75bb4ddbd718d8d92d1c 100644 --- a/spec/lib/gitlab/ci/config/entry/job_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/job_spec.rb @@ -115,7 +115,7 @@ describe Gitlab::Ci::Config::Entry::Job do it 'returns error about value too high' do expect(entry).not_to be_valid - expect(entry.errors).to include 'job retry must be less than 10' + expect(entry.errors).to include 'job retry must be less than or equal to 2' end end end