Skip to content

Add link for violated commits

Martin Čavoj requested to merge 433403-link-to-commits into master

What does this MR do and why?

This MR adds a link to the unsigned commits listed in the detailed policy bot comment.

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.

Before After
CleanShot_2024-04-10_at_15.37.33_2x CleanShot_2024-04-10_at_15.37.15_2x

How to set up and validate locally

  1. In rails console enable the feature flag
    Feature.enable(:save_policy_violation_data)
  2. Create a new project
  3. Go to Secure -> Policies and create a new policy:
    type: approval_policy
    name: Any MR
    description: ''
    enabled: true
    rules:
      - type: any_merge_request
        branch_type: protected
        commits: unsigned
    actions:
      - type: require_approval
        approvals_required: 1
        role_approvers:
          - developer
    approval_settings:
      block_branch_modification: false
      prevent_pushing_and_force_pushing: false
      prevent_approval_by_author: true
      prevent_approval_by_commit_author: true
      remove_approvals_with_new_commit: true
      require_password_to_approve: true
  4. In the project, create an MR that updates README using Web IDE
  5. Verify that approvals for Any MR are required and the commit listed in the comment is a functioning link

Related to #433403 (closed)

Merge request reports