debian-mirror-gitlab/app/presenters/ci/build_presenter.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

47 lines
1 KiB
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
module Ci
2020-03-13 15:44:24 +05:30
class BuildPresenter < ProcessablePresenter
2022-06-21 17:19:12 +05:30
presents ::Ci::Build, as: :build
2021-11-18 22:05:49 +05:30
2021-11-11 11:23:49 +05:30
def status_title(status = detailed_status)
2017-08-17 22:00:37 +05:30
if auto_canceled?
"Job is redundant and is auto-canceled by Pipeline ##{auto_canceled_by_id}"
2018-05-09 12:01:36 +05:30
else
2021-11-11 11:23:49 +05:30
tooltip_for_badge(status)
2017-08-17 22:00:37 +05:30
end
end
2018-03-17 18:26:18 +05:30
def trigger_variables
return [] unless trigger_request
@trigger_variables ||=
if pipeline.variables.any?
pipeline.variables.map(&:to_runner_variable)
else
trigger_request.user_variables
end
end
2018-05-09 12:01:36 +05:30
2018-12-05 23:21:45 +05:30
def execute_in
scheduled? && scheduled_at && [0, scheduled_at - Time.now].max
end
2023-07-09 08:55:56 +05:30
def failure_message
callout_failure_message if build.failed?
end
2018-05-09 12:01:36 +05:30
private
2021-11-11 11:23:49 +05:30
def tooltip_for_badge(status)
status.badge_tooltip.capitalize
2018-05-09 12:01:36 +05:30
end
def detailed_status
2022-06-21 17:19:12 +05:30
@detailed_status ||= build.detailed_status(user)
2018-05-09 12:01:36 +05:30
end
2017-08-17 22:00:37 +05:30
end
end
2021-03-11 19:13:27 +05:30
2021-06-08 01:23:25 +05:30
Ci::BuildPresenter.prepend_mod_with('Ci::BuildPresenter')