Skip to content

Update feature flag structure for policy settings

Alexander Turinske requested to merge 421623-separate-feature-flags into master

What does this MR do and why?

Consolidate feature flags

  • remove :scan_result_policy_settings feature flag
  • use :scan_result_policies_block_unprotecting_branches in its place
  • decouple :scan_result_any_merge_request feature flag from :scan_result_policies_block_unprotecting_branches
  • update util methods to use gon instead of glFeatures
  • update tests

Changelog: removed

EE: true

Screenshots or screen recordings

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

Global search Proof of removal
scan_result_policy_settings Screenshot_2023-10-23_at_09.23.27
scanResultPolicySettings Screenshot_2023-10-23_at_09.23.52
Scenario Expected Screenshot
"Feature.enable(:scan_result_policies_block_unprotecting_branches) && Feature.enable(:scan_result_any_merge_request)" Settings section shows, initial setting shows, merge request type shows with settings srps_e_-mrp_e_-unprotect_e-_a
"Feature.enable(:scan_result_policies_block_unprotecting_branches) && Feature.disable(:scan_result_any_merge_request)" Settings section shows, initial setting shows, merge request type does not appear srps_e_-unpro_e-_a
"Feature.disable(:scan_result_policies_block_unprotecting_branches) && Feature.enable(:scan_result_any_merge_request)" Settings section shows with empty message, merge request type shows with settings mrp_e_-unpro_d-a
"Feature.disable(:scan_result_policies_block_unprotecting_branches) && Feature.disable(:scan_result_any_merge_request)" Settings section does not show srps_d_-_mrpe_d-_a
Old description before I thought better of it
Scenario Expected Screenshot
"Feature.enable(:scan_result_policy_settings) && Feature.enable(:scan_result_policies_block_unprotecting_branches) && Feature.enable(:scan_result_any_merge_request)" Settings section shows, initial setting shows, merge request type shows with settings srps_e_-mrp_e_-unprotect_e-_a
"Feature.enable(:scan_result_policy_settings) && Feature.enable(:scan_result_policies_block_unprotecting_branches) && Feature.disable(:scan_result_any_merge_request)" Settings section shows, initial setting shows, merge request type does not appear srps_e_-unpro_e-_a
"Feature.enable(:scan_result_policy_settings) && Feature.disable(:scan_result_policies_block_unprotecting_branches) && Feature.enable(:scan_result_any_merge_request)" Settings section shows with empty message, merge request type shows with settings mrp_e_-unpro_d-a
"Feature.enable(:scan_result_policy_settings) && Feature.disable(:scan_result_policies_block_unprotecting_branches) && Feature.disable(:scan_result_any_merge_request)" Settings section shows with empty message, merge request type does not appear srps_e_-unpro_d-_a
"Feature.disable(:scan_result_policy_settings) && Feature.enable(:scan_result_policies_block_unprotecting_branches) && Feature.enable(:scan_result_any_merge_request)" Settings section shows with empty message, merge request type shows with settings srps_d_-mrpe_e-_a
"Feature.disable(:scan_result_policy_settings) && Feature.enable(:scan_result_policies_block_unprotecting_branches) && Feature.disable(:scan_result_any_merge_request)" Settings section does not show srps_d_-_mrpe_d-_a
"Feature.disable(:scan_result_policy_settings) && Feature.disable(:scan_result_policies_block_unprotecting_branches) && Feature.enable(:scan_result_any_merge_request)" Settings section shows with empty message, merge request type shows with settings srps_d_-mrpe_e-_a
"Feature.disable(:scan_result_policy_settings) && Feature.disable(:scan_result_policies_block_unprotecting_branches) && Feature.disable(:scan_result_any_merge_request)" Settings section does not show srps_d_-_mrpe_d-_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. Navigate to a project/group => Secure => Policies => New policy => Scan Result Policy
  3. Toggle feature flags like in the options above
echo "Feature.disable(:scan_result_policy_settings) && Feature.enable(:scan_result_policies_block_unprotecting_branches) && Feature.enable(:scan_result_any_merge_request)" | rails c
  1. Verify the policy editor with expected field above
  2. Navigate to yaml mode, change a setting, navigate back
  3. Verify the rule mode has updated and is not disabled

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

Edited by Alexander Turinske

Merge request reports