Skip to content

Rebase without pipeline to skip refreshing external status check

What does this MR do and why?

Related issue: https://jihulab.com/gitlab-cn/gitlab/-/issues/2723

Upstream MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/117022

Some Chinese users hope to rebase without pipeline action also skip the external status check with the similar logic. So JH will create the new status check response records with skipped status when the user click rebase without pipeline. These skipped records can be used to check if its last status is succeed, then the merge action will not be blocked by original pending status check result.

Screenshots or screen recordings

Before:

image

After:

image

Queries

Generated by MergeRequests::ExternalStatusCheck#status

Previously

SELECT "status_check_responses".*
FROM "status_check_responses"
WHERE "status_check_responses"."merge_request_id" = 87
  AND "status_check_responses"."external_status_check_id" = 97
  AND "status_check_responses"."sha" = '\xb83d6e391c22777fca1ed3012fce84f633d7fed0'
ORDER BY "status_check_responses"."id" DESC
LIMIT 1

Now

Use previous query and:

SELECT "status_check_responses".*
FROM "status_check_responses"
WHERE "status_check_responses"."merge_request_id" = 89
  AND "status_check_responses"."status" != 2
  AND "status_check_responses"."external_status_check_id" = 99
ORDER BY "status_check_responses"."id" DESC
LIMIT 1

How to set up and validate locally

1. Config Merge Requests options

  1. In a project Setting -> Merge Requests page, choose Fast-forward merge for Merge method option. image
  2. Check these options for Merge checks: Pipelines must succeed / Skipped pipelines are considered successful / Status checks must succeed. image
  3. Add some status check rules in Status checks. image
  4. Click 'Save changes' button.

2. Rebase workflow

  1. Create a new MR, such as named mr001, confirm the first pipeline is passed.
  2. Use curl or Postman tool to request the API to Set status of an external status check, confirm all status check rules are passed. image
  3. Add a new commit in main branch.
  4. Refresh mr001 MR page, should see the Rebase without pipeline button displayed, click it. image
  5. Refresh mr001 MR page again, should see the Merge button displayed, and all the status check still remain the passed state. image
  6. Click the Merge button, the mr001 MR should be merged successfully.
xfyuan 编辑于

合并请求报告

加载中