diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-08 12:06:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-08 12:06:09 +0300 |
commit | 77a7772c3bdb03d92cbc154f6b1a762953cc7c19 (patch) | |
tree | b841c2233afb01d1b6cc7dd4023f2b677ec19eb3 /app/controllers/projects/pipelines_controller.rb | |
parent | f7234a0894db99c7ade3cf29c1b467aa4807cc41 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/projects/pipelines_controller.rb')
-rw-r--r-- | app/controllers/projects/pipelines_controller.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb index cfa46705483..1bacdc0b1b2 100644 --- a/app/controllers/projects/pipelines_controller.rb +++ b/app/controllers/projects/pipelines_controller.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class Projects::PipelinesController < Projects::ApplicationController + include ::Gitlab::Utils::StrongMemoize + before_action :whitelist_query_limiting, only: [:create, :retry] before_action :pipeline, except: [:index, :new, :create, :charts] before_action :set_pipeline_path, only: [:show] @@ -151,6 +153,19 @@ class Projects::PipelinesController < Projects::ApplicationController @counts[:failed] = @project.all_pipelines.failed.count(:all) end + def test_report + return unless Feature.enabled?(:junit_pipeline_view, project) + + if pipeline_test_report == :error + render json: { status: :error_parsing_report } + return + end + + render json: TestReportSerializer + .new(current_user: @current_user) + .represent(pipeline_test_report) + end + private def serialize_pipelines @@ -217,6 +232,14 @@ class Projects::PipelinesController < Projects::ApplicationController view_context.limited_counter_with_delimiter(finder.execute) end + + def pipeline_test_report + strong_memoize(:pipeline_test_report) do + @pipeline.test_reports + rescue Gitlab::Ci::Parsers::ParserError + :error + end + end end Projects::PipelinesController.prepend_if_ee('EE::Projects::PipelinesController') |