Commit 23223ba6 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Do not allow to auto-retry a job more than 2 times

parent f49a906a
...@@ -1147,7 +1147,7 @@ up to the amount of times specified by the `retry` keyword. ...@@ -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 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 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: A simple example:
......
...@@ -25,7 +25,7 @@ module Gitlab ...@@ -25,7 +25,7 @@ module Gitlab
validates :allow_failure, boolean: true validates :allow_failure, boolean: true
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: 10 } less_than_or_equal_to: 2 }
validates :when, validates :when,
inclusion: { in: %w[on_success on_failure always manual], inclusion: { in: %w[on_success on_failure always manual],
message: 'should be on_success, on_failure, ' \ message: 'should be on_success, on_failure, ' \
......
...@@ -115,7 +115,7 @@ describe Gitlab::Ci::Config::Entry::Job do ...@@ -115,7 +115,7 @@ describe Gitlab::Ci::Config::Entry::Job do
it 'returns error about value too high' do it 'returns error about value too high' do
expect(entry).not_to be_valid 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 end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment