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 |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
- Upload a GitLab Ultimate license
- Enable feature flag
scan_result_policies_block_force_push
- Navigate to a project
- Create a protected branch called
spooky-stuff
- 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
- Navigate to the project => Settings => Repository => Protected braches
- Verify the
Allowed to push and merge
dropdown is disabled and set toNo one
- Verify the
Allowed to force push
toggle is disabled and toggled off - Verify only the affected branch settings are disabled and other branch settings are enabled
- Verify hovering over the settings shows the pop-ups
- Verify the other branches' settings can be updated
- Verify the other settings on the affected branches can be updated
- Navigate to Secure => Policies => Selected newly created policy => Edit policy =>
enabled: false
=> Save poliyc - Navigate to the project => Settings => Repository => Protected braches
- 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.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #428231 (closed)
Edited by Alexander Turinske