gitlab-org--gitlab-foss/app/presenters/commit_status_presenter.rb

28 lines
926 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class CommitStatusPresenter < Gitlab::View::Presenter::Delegated
CALLOUT_FAILURE_MESSAGES = {
2018-07-30 11:05:50 -04:00
unknown_failure: 'There is an unknown failure, please try again',
script_failure: nil,
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',
missing_dependency_failure: 'There has been a missing dependency failure',
runner_unsupported: 'Your runner is outdated, please upgrade your runner'
}.freeze
presents :build
def callout_failure_message
2018-07-30 11:05:50 -04:00
CALLOUT_FAILURE_MESSAGES.fetch(failure_reason.to_sym)
end
def recoverable?
failed? && !unrecoverable?
end
def unrecoverable?
2018-08-01 06:23:43 -04:00
script_failure? || missing_dependency_failure?
end
end