2018-07-24 10:00:56 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-16 20:58:20 +00:00
|
|
|
class CommitStatusPresenter < Gitlab::View::Presenter::Delegated
|
|
|
|
CALLOUT_FAILURE_MESSAGES = {
|
|
|
|
unknown_failure: 'There is an unknown failure, please try again',
|
|
|
|
api_failure: 'There has been an API failure, please try again',
|
|
|
|
stuck_or_timeout_failure: 'There has been a timeout failure or the job got stuck. Check your timeout limits or try again',
|
|
|
|
runner_system_failure: 'There has been a runner system failure, please try again',
|
2018-07-17 10:58:57 +00:00
|
|
|
missing_dependency_failure: 'There has been a missing dependency failure',
|
|
|
|
# COMMENTED to check if tests gonna fail: runner_unsupported: 'Your runner is unsupported. Upgrade runner to use new features of your Pipeline',
|
2018-05-16 20:58:20 +00:00
|
|
|
}.freeze
|
|
|
|
|
|
|
|
presents :build
|
|
|
|
|
|
|
|
def callout_failure_message
|
|
|
|
CALLOUT_FAILURE_MESSAGES[failure_reason.to_sym]
|
|
|
|
end
|
|
|
|
|
|
|
|
def recoverable?
|
|
|
|
failed? && !unrecoverable?
|
|
|
|
end
|
|
|
|
|
|
|
|
def unrecoverable?
|
2018-07-17 10:58:57 +00:00
|
|
|
script_failure? || missing_dependency_failure? || runner_unsupported?
|
2018-05-16 20:58:20 +00:00
|
|
|
end
|
2018-05-15 18:03:09 +00:00
|
|
|
end
|