From 905c1110b08f93a19661cf42a276c7ea90d0a0ff Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 22 Oct 2019 11:31:16 +0000 Subject: Add latest changes from gitlab-org/gitlab@12-4-stable-ee --- app/controllers/projects/pipelines_controller.rb | 25 +++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'app/controllers/projects/pipelines_controller.rb') diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb index cfa46705483..106ef1b72c1 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 @@ -169,7 +184,7 @@ class Projects::PipelinesController < Projects::ApplicationController end def show_represent_params - { grouped: true } + { grouped: true, expanded: params[:expanded].to_a.map(&:to_i) } end def create_params @@ -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') -- cgit v1.2.1