summaryrefslogtreecommitdiff
path: root/app/controllers/projects/pipelines_controller.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-22 11:31:16 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-22 11:31:16 +0000
commit905c1110b08f93a19661cf42a276c7ea90d0a0ff (patch)
tree756d138db422392c00471ab06acdff92c5a9b69c /app/controllers/projects/pipelines_controller.rb
parent50d93f8d1686950fc58dda4823c4835fd0d8c14b (diff)
downloadgitlab-ce-905c1110b08f93a19661cf42a276c7ea90d0a0ff.tar.gz
Add latest changes from gitlab-org/gitlab@12-4-stable-ee
Diffstat (limited to 'app/controllers/projects/pipelines_controller.rb')
-rw-r--r--app/controllers/projects/pipelines_controller.rb25
1 files changed, 24 insertions, 1 deletions
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')