Skip to content

Add "Prevent Force Pushing" setting

Alexander Turinske requested to merge 428232-add-additional-setting into master

What does this MR do and why?

Add "Prevent Force Pushing" setting

  • hide behind ":scan_result_policies_block_force_push" feature flag
  • ensure feature flag is independent of both the ":scanResultPoliciesBlockUnprotectingBranches" and ":scanResultAnyMergeRequest" feature flags and works with them
  • update tests

Screenshots or screen recordings

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

Scenario Policy Editor Rule Mode Yaml
scan_result_policies_block_force_push on force_ff_on_-_settings force_ff_on_-_yaml
scanResultPoliciesBlockUnprotectingBranches on and scan_result_policies_block_force_push on prevent_ff_on_force_ff_on_-_settings prevent_ff_on_force_ff_on_-_yaml
scanResultAnyMergeRequest on and scan_result_policies_block_force_push on ff_on__merge_ff_on_-_settings force_ff_on__merge_ff_on_-_yaml
all on all_on_-_settings all_on_-_yaml

How to set up and validate locally

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

  1. Enable a feature flag that adds settings
echo "Feature.enable(:scan_result_policies_block_force_push)" | rails c
  1. Upload a GitLab Ultimate license
  2. Navigate to a project/group => Secure => Policies => New policy => Scan Result Policy
  3. Verify the setting displays and can be modified and reflected in the yaml correctly
  4. Select a policy type
  5. Verify the setting displays and can be modified and reflected in the yaml
  6. Modify various feature flags and ensure they interact appropriately
echo "Feature.disable(:scan_result_policies_block_unprotecting_branches) && Feature.disable(:scan_result_any_merge_request)" | rails c

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 #428232 (closed)

Edited by Alexander Turinske

Merge request reports

Loading