Skip to content

Disable settings for protected branch

What does this MR do and why?

Disable settings for protected branch Alexander Turinske authored 1 hour ago

  • if a policy has the "prevent_force_push" setting in it, disable the repository settings for those protected branches
  • add popover for force push toggle
  • add popover for push dropdown

Changelog: changed

EE: true

Screenshots or screen recordings

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

Before After
settings_-_b settings_-_a

How to set up and validate locally

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

  1. Upload a GitLab Ultimate license
  2. Enable feature flag scan_result_policies_block_force_push
  3. Navigate to a project
  4. Create a protected branch called spooky-stuff
  5. Navigate to Secure => Policies => New policy => Scan Result Policy => Yaml mode => Use the yaml below and save it
type: scan_result_policy
name: License Approval Policy
description: The GitLab legal team requires approval of licenses that have not been
  preapproved for use.
enabled: true
actions:
- type: require_approval
  approvals_required: 1
  role_approvers:
  - maintainer
  - owner
rules:
- type: license_finding
  branches:
  - spooky-stuff
  match_on_inclusion: false
  license_types:
  - 3dfx Glide License
  license_states:
  - newly_detected
approval_settings:
  prevent_force_pushing: true
  1. Navigate to the project => Settings => Repository => Protected braches
  2. Verify the Allowed to push and merge dropdown is disabled and set to No one
  3. Verify the Allowed to force push toggle is disabled and toggled off
  4. Verify only the affected branch settings are disabled and other branch settings are enabled
  5. Verify hovering over the settings shows the pop-ups
  6. Verify the other branches' settings can be updated
  7. Verify the other settings on the affected branches can be updated
  8. Navigate to Secure => Policies => Selected newly created policy => Edit policy => enabled: false => Save poliyc
  9. Navigate to the project => Settings => Repository => Protected braches
  10. Verify the value for Allowed to push and merge dropdown went back to the previous value

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #428231 (closed)

Edited by Alexander Turinske

Merge request reports