Skip to content

Add API to query MR list in monorepo mode

路志远请求将feat-monorepo-add-get-api合并到main-jh

Related issue: https://jihulab.com/gitlab-cn/gitlab/-/issues/3147 | Subsequent MR: Add API to bulk merge MR list in monorepo mode

What does this MR do and why?

Add an API to query MR list in monorepo mode

GET /{project_path}/-/merge_requests/{mr_id}.json?serializer=monorepo

iShot_2023-08-21_17.57.55

Screenshots or screen recordings

The return value of this API is used to display on the new MR list widget:

How to set up and validate locally

  1. Under the same Group, create multiple Projects

  2. Create an MR in each Project, and these MRs meet the following conditions

    • have the same source_branch
    • have monorepo label
  3. Call this new API:

    PROJECT_PATH=flightjs/Flight
    MERGE_REQUEST_ID=24
    YOUR_COOKIES_FROM_BROWSER='...'
    curl --location 'http://127.0.0.1:3000/$PROJECT_PATH/-/merge_requests/$MERGE_REQUEST_ID.json?serializer=monorepo' \
    --header 'Cookie: $YOUR_COOKIES_FROM_BROWSER'

    Expect the following result

    {
        "merge_requests_list_status": "can_be_merged",
        "other_merging_branch": null,
        "merged_by_user": null,
        "has_permission_to_merge": true,
        "merge_requests": [
            {
                "title": "Update file xxx",
                "path": "/flightjs/Flight/-/merge_requests/24",
                "merge_error": null,
                "mergeable": true,
                "state": "opened",
                "head_pipeline": {
                    "icon": "status_success",
                    "text": "已通过",
                    "label": "已通过",
                    "group": "success",
                    "tooltip": "已通过",
                    "has_details": true,
                    "details_path": "/flightjs/Flight/-/pipelines/581",
                    "illustration": null,
                    "favicon": "/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2.png"
                },
                "breadcrumbs": [
                    {
                        "text": "flightjs",
                        "href": "/flightjs"
                    },
                    {
                        "text": "Flight",
                        "href": "/flightjs/Flight"
                    }
                ],
                "approvals_given": 0,
                "approvals_left": 0
            },
        ]
    }

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

路志远 编辑于

合并请求报告

加载中