Skip to content

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 Enabled Project inherits from group
Enabled Enabled false Disabled Project explicitly overrides
Enabled Enabled true Enabled Project explicitly enabled
Enabled Disabled nil Disabled Project inherits from group
Enabled Disabled true Enabled Project overrides group
Disabled Enabled nil Enabled Project inherits from group
Enabled nil nil Enabled Project inherits from instance
Disabled nil true Enabled Project overrides instance
  • Number of records that would be updated in project_settings table in the BBM: 43468874

How to set up and validate locally

Instance Level Settings

  1. Prerequisites: Log in as an admin user and ensure Duo features are set up locally

  2. Enable instance-wide: ApplicationSetting.current.update!(auto_duo_code_review_enabled: true)

  3. Test inheritance: Create an MR in any project and verify @GitLabDuo is automatically added as reviewer

Group Level Settings

  1. Enable for specific group:

    group = Group.find_by_full_path('your-group-path')
    group.namespace_settings.update!(auto_duo_code_review_enabled: true)
  2. Test inheritance: Create MR in a project within this group and verify Duo Code Review is enabled

  3. 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
  • nil values now inherit from parent settings instead of defaulting to false

Draft MR Behaviour

  1. Create Draft MR: Verify @GitLabDuo is NOT added as reviewer initially
  2. Mark as Ready: Use UI button or /ready quick action
  3. Verify: @GitLabDuo should 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

Merge request reports

Loading