Fix issue where settings showed up without feature flags
What does this MR do and why?
Fix issue where settings showed up with feature fs
- the policy yaml
approval_settingsneeds to be updated when the rules are updated depending on the rule type because certain rules add additional settings - this should only happen when the proper feature flags are enabled that result in different settings being added
- update tests
Changelog: fixed
EE: true
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
Scenario 1
- Upload a GitLab Ultimate license
- Put the feature flags in the appropriate state with the following command
echo "Feature.disable(:scan_result_policy_settings) && Feature.disable(:scan_result_any_merge_request)" | rails c
- Navigate to a project => Secure => Policies => New policy => Scan Result Policy
- Verify the yaml does not have any
approval_settings - Select a policy type
- Verify the yaml does not have any
approval_settings
Scenario 2
- Upload a GitLab Ultimate license
- Put the feature flags in the appropriate state with the following command
echo "Feature.enable(:scan_result_policy_settings) && Feature.disable(:scan_result_any_merge_request)" | rails c
- Navigate to a project => Secure => Policies => New policy => Scan Result Policy
- Verify the yaml has one setting in
approval_settings - Select a policy type
- Verify the yaml has one setting in
approval_settingsand it is unchanged
Scenario 3
- Upload a GitLab Ultimate license
- Put the feature flags in the appropriate state with the following command
echo "Feature.disable(:scan_result_policy_settings) && Feature.enable(:scan_result_any_merge_request)" | rails c
- Navigate to a project => Secure => Policies => New policy => Scan Result Policy
- Verify the yaml does not have any
approval_settings - Select the
scan_resultpolicy type - Verify the yaml does not have any
approval_settings - Select the
merge requestpolicy type - Verify the yaml does not have any
approval_settings
Scenario 4
- Upload a GitLab Ultimate license
- Put the feature flags in the appropriate state with the following command
echo "Feature.enable(:scan_result_policy_settings) && Feature.enable(:scan_result_any_merge_request)" | rails c
- Navigate to a project => Secure => Policies => New policy => Scan Result Policy
- Verify the yaml has one setting in
approval_settings - Select the
scan_resultpolicy type - Verify the yaml has one setting in
approval_settings - Select the
merge requestpolicy type - Verify the yaml has many settings in
approval_settings
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
| Scenario | Before | After |
|---|---|---|
| 1 | ![]() |
![]() |
| 2 | ![]() |
![]() |
| 3 | ![]() |
![]() |
| 4 | ![]() |
![]() |
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 #428538 (closed)
Edited by Alexander Turinske







