Enable Duo Code Review by default for new customers

What does this MR do and why?

Enable Duo Code Review by default for new customers, shows a banner on the "Get started" page of their new group that explains that Code Review is enabled. Controlled with the :dap_code_review_default_on_new_signups feature flag.

Changelog: changed EE: true

Screenshots

image

References

How to set up and validate locally

  1. Turn on feature flags
# Enable required feature flags
Feature.enable(:dap_code_review_default_on_new_signups)
Feature.enable(:ultimate_trial_with_dap)
Feature.enable(:dap_free_tier_gitlab_credits)
Feature.enable(:service_accounts_available_on_free_or_unlicensed)

# Disable email confirmation so you can sign in immediately
Gitlab::CurrentSettings.update!(email_confirmation_setting: 'off')
  1. Since GDK typically does not have CDot fully setup and does not run low priority Sidekiq queues by default, you'll have to simulate the trial completing. In rails console:
org = Organizations::Organization.find(1)
user = User.new(name: 'Test', username: 'testuser8', email: 'test8@example.com', password: 'gizmogizmo', confirmed_at: Time.now)
user.assign_personal_namespace(org)
user.save!
Organizations::OrganizationUser.create!(organization: org, user: user, access_level: :owner)
group = Groups::CreateService.new(user, name: 'testgroup5', path: 'testgroup5', visibility_level: 20, organization_id: org.id).execute.payload[:group]
project = Projects::CreateService.new(user, name: 'My Project', namespace_id: group.id, organization_id: org.id).execute
Onboarding::Progress.onboard(group.reset)
group.gitlab_subscription.update!(trial: true, trial_starts_on: Date.current, trial_ends_on: 1.year.from_now)
GitlabSubscriptions::AddOnPurchase.create!(add_on: GitlabSubscriptions::AddOn.find_or_create_by!(name: :gitlab_credits, description: 'Add-on for GitLab Credits.'), namespace: group, organization: org, quantity: 1, started_at: Time.current, expires_on: 1.year.from_now, purchase_xid: 'fake-purchase5')
GitlabSubscriptions::Trials::ApplyTrialService.new(uid: user.id, trial_user_information: { namespace_id: group.id }).send(:after_success_hook)
Namespaces::CascadeDuoSettingsWorker.new.perform(group.id, { 'duo_foundational_flows_enabled' => true, 'auto_duo_code_review_enabled' => true, 'enabled_foundational_flows' => ['code_review/v1'] }, user.id)
Ai::Catalog::Flows::CascadeSyncFoundationalFlowsWorker.new.perform(group.id, user.id)
  1. Navigate to http://gdk.test:3000/testgroup/my-project/-/get_started to see the "Automated code review is enabled" banner
  2. Click "To opt out, change your settings." or navigate to http://gdk.test:3000/groups/testgroup/-/settings/merge_requests — the "Enable automatic reviews by GitLab Duo" toggle should be checked
  3. Start an MR in the project, GitlabDuo should be assigned as a review and start a review (if you have Duo Workflow setup)

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 #592822

Edited by Allen Cook

Merge request reports

Loading