Skip to content

Add backend support for group MR settings (part 1)

This MR completes this issue and this epic at the same time: #372040 (closed) & &8704 (closed)

There are 3 settings that project maintainers can use to control when merges happen:

  • only_allow_merge_if_pipeline_succeeds?
  • allow_merge_on_skipped_pipeline?
  • only_allow_merge_if_all_discussions_are_resolved?

Regulated customers want the ability to control these options at the group level setting (only accessible by Group Owners), that cannot be overridden by the project level setting.

In order to facilitate the code review, I divided it into these MRs:

Screenshots or screen recordings

No UI changes.

Final goal of these MRs

Add Merge requests > Merge checks settings support for group level.

What does this current MR do and why?

The changes revolve around these three configuration items:

only_allow_merge_if_pipeline_succeeds?
allow_merge_on_skipped_pipeline?
only_allow_merge_if_all_discussions_are_resolved?
  1. Backend: Add feature flag support_group_level_merge_checks_setting
  2. Backend: Add two new methods, [configuration]?(inherit_group_setting: bool) and [configuration]_locked? to the projects model for each configuration option.
  • only_allow_merge_if_pipeline_succeeds?:

    • #only_allow_merge_if_pipeline_succeeds?(inherit_group_setting: bool)
    • #only_allow_merge_if_pipeline_succeeds_locked?
  • allow_merge_on_skipped_pipeline?:

    • #allow_merge_on_skipped_pipeline?(inherit_group_setting: bool)
    • #allow_merge_on_skipped_pipeline_locked?
  • only_allow_merge_if_all_discussions_are_resolved?:

    • #only_allow_merge_if_all_discussions_are_resolved?(inherit_group_setting: bool)
    • #only_allow_merge_if_all_discussions_are_resolved_locked?

    These methods will be extended to cascade configuration in EE.

  1. Backend: Update mergeable_discussions_state? and other methods to use [configuration]?(inherit_group_setting: bool) instead of [configuration]

cc @prajnamas

Edited by Zhiyuan Lu

Merge request reports