diff options
Diffstat (limited to 'app/presenters/ci/pipeline_presenter.rb')
-rw-r--r-- | app/presenters/ci/pipeline_presenter.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/presenters/ci/pipeline_presenter.rb b/app/presenters/ci/pipeline_presenter.rb index 099b4720fb6..cc2bce9862d 100644 --- a/app/presenters/ci/pipeline_presenter.rb +++ b/app/presenters/ci/pipeline_presenter.rb @@ -1,11 +1,21 @@ module Ci class PipelinePresenter < Gitlab::View::Presenter::Delegated + include Gitlab::Utils::StrongMemoize + FAILURE_REASONS = { config_error: 'CI/CD YAML configuration error!' }.freeze presents :pipeline + def failed_builds + return [] unless can?(current_user, :read_build, pipeline) + + strong_memoize(:failed_builds) do + pipeline.builds.latest.failed + end + end + def failure_reason return unless pipeline.failure_reason? |