Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/presenters/ci/pipeline_presenter.rb')
-rw-r--r--app/presenters/ci/pipeline_presenter.rb10
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?