Skip to content

Add onlyAllowMergeIfAllStatusChecksPassed setting to MR object

Daniel Tian requested to merge 369861-add-status-check-setting-to-mr into master

What does this MR do and why?

This MR adds the onlyAllowMergeIfAllStatusChecksPassed property to the MR object used by the MR widgets on the MR details page. It's added in 2 places, to the response for widget.json, and to the response for the GraphQL call:

widget.json GraphQL call
ksnip_20221028-150618 ksnip_20221028-152215

The GraphQL call data is used when the merge_request_widget_graphql feature flag is on (the default), and the widget.json data is used when the feature flag is off. Note that the onlyAllowMergeIfAllStatusChecksPassed property is only added if the externalStatusChecks license feature is enabled (a GitLab Ultimate feature).

Note that this only adds the property to the data, but it's not used in this MR. A follow-up MR will use the data to show a message in the status checks MR widget when the MR can't be merged due to failing status checks.

How to set up and validate locally

  1. Enable the only_allow_merge_if_all_status_checks_passed feature flag.

  2. Go to any project -> Settings -> Merge requests, then find the "Status checks must succeed" checkbox. Check it and save the change.

  3. Create a MR or go to an existing MR. Verify that in the network tab, widget.json and the getState GraphQL call (usually the 2nd GraphQL call in the network list) has the onlyAllowMergeIfAllStatusChecksPassed property set to true.

  4. Go back to the project settings, uncheck the "Status checks must succeed" checkbox, and save the change. Refresh the MR page and verify that the onlyAllowMergeIfAllStatusChecksPassed property is set to false.

  5. Use the following command to delete all EE files to get GDK to act as if it's in FOSS mode. While there are other ways listed on how to get GDK to act as if it's FOSS, this is the only way I found that actually works:

rm -rf ee/ qa/spec/ee/ qa/qa/specs/features/ee/ qa/qa/ee/ qa/qa/ee.rb
  1. Restart your GDK, then go back to the MR details page. Verify that the onlyAllowMergeIfAllStatusChecksPassed property is not added to either response.

MR acceptance checklist

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

Related to #369861 (closed)

Edited by Daniel Tian

Merge request reports