diff options
author | Markus Doits <markus.doits@stellenticket.de> | 2018-09-15 15:31:36 +0300 |
---|---|---|
committer | Markus Doits <markus.doits@stellenticket.de> | 2018-11-07 15:00:40 +0300 |
commit | 39204d8c6184328b21e4057aaa78d698abd56e29 (patch) | |
tree | 439561ceb5aa539946ac48f796578ce3f03e103b /app/models | |
parent | 007db85dd4e4c92e060160427429c4fb2ad5cb32 (diff) |
refactor retry logic to define any reason and more than one reason to retry
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/build.rb | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 592b784807c..08d6e669cf9 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -324,20 +324,15 @@ module Ci def retry_when retries = self.options[:retry] - retries.is_a?(Hash) && retries.fetch(:when, 'always').to_s || 'always' + Array.wrap( + retries.is_a?(Hash) && retries.fetch(:when, 'always') || 'always' + ) end def retry_failure? return false if retries_max.zero? || retries_count >= retries_max - case failure_reason.to_s - when 'runner_system_failure' - %['always', 'system failure'].include?(retry_when) - when 'script_failure' - %['always', 'script failure'].include?(retry_when) - else - retry_when == 'always' - end + retry_when.include?('always') || retry_when.include?(failure_reason.to_s) end def latest? |