BigW Consortium Gitlab

pipeline_presenter.rb 518 Bytes
Newer Older
1
module Ci
2
  class PipelinePresenter < Gitlab::View::Presenter::Delegated
3 4 5 6 7
    FAILURE_REASONS = {
      config_error: 'CI/CD YAML configuration error!'
    }.freeze

    presents :pipeline
8 9 10 11 12 13 14

    def failure_reason
      return unless pipeline.failure_reason?

      FAILURE_REASONS[pipeline.failure_reason.to_sym] ||
        pipeline.failure_reason
    end
15 16

    def status_title
17 18 19
      if auto_canceled?
        "Pipeline is redundant and is auto-canceled by Pipeline ##{auto_canceled_by_id}"
      end
20 21 22
    end
  end
end