summaryrefslogtreecommitdiff
path: root/app/serializers/job_entity.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/serializers/job_entity.rb')
-rw-r--r--app/serializers/job_entity.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/serializers/job_entity.rb b/app/serializers/job_entity.rb
index 523b522d449..960e7291ae6 100644
--- a/app/serializers/job_entity.rb
+++ b/app/serializers/job_entity.rb
@@ -26,6 +26,8 @@ class JobEntity < Grape::Entity
expose :created_at
expose :updated_at
expose :detailed_status, as: :status, with: StatusEntity
+ expose :callout_message, if: -> (*) { failed? && !build.script_failure? }
+ expose :recoverable, if: -> (*) { failed? }
private
@@ -50,4 +52,20 @@ class JobEntity < Grape::Entity
def path_to(route, build)
send("#{route}_path", build.project.namespace, build.project, build) # rubocop:disable GitlabSecurity/PublicSend
end
+
+ def failed?
+ build.failed?
+ end
+
+ def callout_message
+ build_presenter.callout_failure_message
+ end
+
+ def recoverable
+ build_presenter.recoverable?
+ end
+
+ def build_presenter
+ @build_presenter ||= build.present
+ end
end