Skip to content

Add multiple approvers action support for a policy helper

What does this MR do and why?

  1. Merge request approval policy now supports multiple approver actions

  2. It is also important to preserve current interface for a backward compatibility

  3. This MR keeps initial scan_result_approvers but also adds new action_approvers

  4. New property has an array format:

    {
      approvers: [
        {
          action_index: 0,
          users: [...],
          groups: [...],
          all_groups: [...],
          roles: [...]
        },
        {
          action_index: 1,
          users: [...],
          groups: [...],
          all_groups: [...],
          roles: [...]
        }
      ]
    }
    

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Description New property
New actions_approvers property
{
  approvers: [
    {
      action_index: 0,
      users: [...],
      groups: [...],
      all_groups: [...],
      roles: [...]
    },
    {
      action_index: 1,
      users: [...],
      groups: [...],
      all_groups: [...],
      roles: [...]
    }
  ]
}

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Go to Project/Group
  2. Secure -> Policies
  3. New Merge Request Approval policy
  4. Create policy with multiple approver actions via yaml mode or add one approver action via rule mode and copy paste it in yaml mode
name: Multiple actions
description: ''
enabled: true
actions:
- type: require_approval
  approvals_required: 1
  role_approvers:
  - maintainer
  group_approvers_ids:
  - 33
- type: require_approval
  approvals_required: 1
  group_approvers_ids:
  - 24
- type: send_bot_message
  enabled: true
rules:
- type: scan_finding
  scanners: []
  vulnerabilities_allowed: 0
  severity_levels: []
  vulnerability_states: []
  branch_type: protected
approval_settings:
  block_branch_modification: true
  prevent_pushing_and_force_pushing: true
  prevent_approval_by_author: true
  prevent_approval_by_commit_author: true
  remove_approvals_with_new_commit: true
  require_password_to_approve: false
policy_scope:
  projects:
    excluding: []
fallback_behavior:
  fail: closed

Related to #490097

Merge request reports

Loading