Add support for instance-wide code review custom instructions

What does this MR do and why?

Introduce a new instance setting to keep a reference to the instance-wide custom instructions applied to all Duo Code Review sessions in that instance, similarly to what was done for groups in !230090 (merged).

This new instance setting is only applied for self-managed instances and should not be visible in the SaaS version.

References

Related to #600996 (closed)

How to set up and validate locally

Group settings - nothing has changed

  1. Choose a group where Duo Agent Platform is enabled (e.g. gitlab-duo)
  2. Navigate to Settings > General > GitLab Duo features: http://gdk.test:3000/groups/gitlab-duo/-/edit#js-gitlab-duo-settings
  3. Check Custom review instructions for groups section
  4. Change/select a project with custom instructions following the docs

sm_group

Instance settings - new setting

  1. Navigate to Admin > GitLab Duo > Change Configuration: http://gdk.test:3000/admin/gitlab_duo/configuration
  2. Check Custom review instructions for groups section
  3. Change/select a project with custom instructions following the docs

sm_instance

Validating backend

You can run the following commands to check if your custom instructions were applied properly after following the steps above:

project = Project.last
merge_request = project.merge_requests.first

::Gitlab::Duo::CodeReview::CustomInstructionsResolver.new(project).execute(merge_request).as_json

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.

Edited by Wanderson Policarpo

Merge request reports

Loading