diff options
author | Mayra Cabrera <mcabrera@gitlab.com> | 2018-04-19 07:20:53 +0000 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2018-04-19 07:20:53 +0000 |
commit | 93780da67ceebac19033bb0c44483e3af2d38a18 (patch) | |
tree | 7123498ec227f75c6d00e8dbab111a2fa3a2e64f /app/presenters | |
parent | 6ef8b497e721fac49a0914802244f98dd5d99078 (diff) | |
download | gitlab-ce-93780da67ceebac19033bb0c44483e3af2d38a18.tar.gz |
Resolve "Show `failure_reason` in jobs view content section"
Diffstat (limited to 'app/presenters')
-rw-r--r-- | app/presenters/ci/build_presenter.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/app/presenters/ci/build_presenter.rb b/app/presenters/ci/build_presenter.rb index 9afebda19be..4873d7ce662 100644 --- a/app/presenters/ci/build_presenter.rb +++ b/app/presenters/ci/build_presenter.rb @@ -1,5 +1,14 @@ module Ci class BuildPresenter < Gitlab::View::Presenter::Delegated + CALLOUT_FAILURE_MESSAGES = { + unknown_failure: 'There is an unknown failure, please try again', + script_failure: 'There has been a script failure. Check the job log for more information', + 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, check the job log for more information' + }.freeze + presents :build def erased_by_user? @@ -35,6 +44,14 @@ module Ci "#{subject.name} - #{detailed_status.status_tooltip}" end + def callout_failure_message + CALLOUT_FAILURE_MESSAGES[failure_reason.to_sym] + end + + def recoverable? + failed? && !unrecoverable? + end + private def tooltip_for_badge @@ -44,5 +61,9 @@ module Ci def detailed_status @detailed_status ||= subject.detailed_status(user) end + + def unrecoverable? + script_failure? || missing_dependency_failure? + end end end |