Allow multiple any_merge_request rules to be created
What does this MR do and why?
Allow multiple merge request approval rules of report_type: any_merge_request
to be created in the same way as scan_finding
and license_scanning
rules.
If there are multiple policies with any_merge_request
type, these must correspond to multiple approval rules. Currently, only one any_merge_request
approval rule is created for a merge request.
This feature behind a feature flag scan_result_any_merge_request
which is disabled by default, hence no changelog entry.
While working on a test for this change, I noticed that existing test was broken in many places and not executed at all, so I fixed that too.
How to set up and validate locally
- In rails console enable the feature flag
Feature.enable(:scan_result_any_merge_request)
- Create two policies with
any_merge_request
type. Sample YAML:type: scan_result_policy name: Any commits description: '' enabled: true rules: - type: any_merge_request branch_type: protected commits: any actions: - type: require_approval approvals_required: 1 user_approvers_ids: - 1 # replace with a valid user ID
- Create MR in the project and verify that both rules are applied
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #418752 (closed)