From f4adb50ef2ddac2b49050b312fd79e8960ead301 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 4 Apr 2019 09:01:09 +0000 Subject: Expose head pipeline in the related merge requests Expose head pipeline for the MR in the api when requesting related merge requests for an issue and show a detailed status for the pipeline, which would include: details_path, favicon, group, icon, label, text, tooltip. https://gitlab.com/gitlab-org/gitlab-ce/issues/57662#note_152023412 --- lib/api/entities.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/api/entities.rb') diff --git a/lib/api/entities.rb b/lib/api/entities.rb index cc62b5a3661..2dd3120d3fc 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -690,6 +690,10 @@ module API # Deprecated expose :allow_collaboration, as: :allow_maintainer_to_push, if: -> (merge_request, _) { merge_request.for_fork? } + expose :reference do |merge_request, options| + merge_request.to_reference(options[:project]) + end + expose :web_url do |merge_request| Gitlab::UrlBuilder.build(merge_request) end @@ -726,6 +730,8 @@ module API merge_request.metrics&.pipeline end + expose :head_pipeline, using: 'API::Entities::Pipeline' + expose :diff_refs, using: Entities::DiffRefs # Allow the status of a rebase to be determined @@ -1267,6 +1273,9 @@ module API expose :created_at, :updated_at, :started_at, :finished_at, :committed_at expose :duration expose :coverage + expose :detailed_status, using: DetailedStatusEntity do |pipeline, options| + pipeline.detailed_status(options[:current_user]) + end end class PipelineSchedule < Grape::Entity -- cgit v1.2.1