Add Automatic DCR Review Settings for Groups and Instances
What does this MR do and why?
- This MR adds cascading settings for enabling automatic Duo Code Review at group and instance levels
- These are the scenarios
| Instance Setting | Group Setting | Project Setting | Result | Behavior |
|---|---|---|---|---|
| Enabled | Enabled | nil |
|
Project inherits from group |
| Enabled | Enabled | false |
|
Project explicitly overrides |
| Enabled | Enabled | true |
|
Project explicitly enabled |
| Enabled | Disabled | nil |
|
Project inherits from group |
| Enabled | Disabled | true |
|
Project overrides group |
| Disabled | Enabled | nil |
|
Project inherits from group |
| Enabled | nil |
nil |
|
Project inherits from instance |
| Disabled | nil |
true |
|
Project overrides instance |
- Number of records that would be updated in
project_settingstable in the BBM:43468874
How to set up and validate locally
Instance Level Settings
-
Prerequisites: Log in as an admin user and ensure Duo features are set up locally
-
Enable instance-wide:
ApplicationSetting.current.update!(auto_duo_code_review_enabled: true) -
Test inheritance: Create an MR in any project and verify
@GitLabDuois automatically added as reviewer
Group Level Settings
-
Enable for specific group:
group = Group.find_by_full_path('your-group-path') group.namespace_settings.update!(auto_duo_code_review_enabled: true) -
Test inheritance: Create MR in a project within this group and verify Duo Code Review is enabled
-
Test override: Set a project to explicitly disable:
project.project_setting.update!(auto_duo_code_review_enabled: false)Verify Duo Code Review is disabled for this project only
Project Level Settings (No Changes Expected)
- Project-level behavior should remain unchanged from current implementation
- Projects can still explicitly enable/disable the feature
-
nilvalues now inherit from parent settings instead of defaulting tofalse
Draft MR Behaviour
-
Create Draft MR: Verify
@GitLabDuois NOT added as reviewer initially -
Mark as Ready: Use UI button or
/readyquick action -
Verify:
@GitLabDuoshould be added and Duo Code Review should execute
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #554070 (closed)
Edited by Kinshuk Singh