Use cascading settings to implement pipeline check in namespace settings
Proposal
Similar to the Disable self-approval at the instance level, this proposal is asking for a "Pipelines must succeed" checkbox in the group area that takes precedence over any project-level "Pipelines must succeed" checkboxes. This should go under the Group > Settings > General screen.
Implementation Plan
- Use https://docs.gitlab.com/ee/development/cascading_settings.html#cascading-settings to implement pipeline check in namespace settings.
- Add settings param in application settings and group settings api.
- override only_allow_merge_if_pipeline_succeeds column in
app/models/project.rbso that it returns correct inherit settings values from ancestors (groups/subgroups).
def only_allow_merge_if_pipeline_succeeds
return Gitlab::CurrentSettings.only_allow_merge_if_pipeline_succeeds if Gitlab::CurrentSettings.lock_only_allow_merge_if_pipeline_succeeds
return super unless group
namespace_setting = group&.namespace_settings
return namespace_setting.only_allow_merge_if_pipeline_succeeds if namespace_setting.only_allow_merge_if_pipeline_succeeds_locked_by_ancestor?
super
end
Edited by Harsimar Sandhu