Skip to content

Allow Suggested Reviewers registration for access tokens

Tan Le requested to merge 377917-only-ultimate-plan-suggested-reviewers into master

What does this MR do and why?

As part of the Suggested Reviewers project registration, we need to generate a project access token and later use it to build a model feature set. Prior to this MR, some projects that are licensed with suggested_reviewers are unable to register with Suggested Reviewers due to a disabled access token creation policy e.g. on a trial plan, or access token creation setting disabled.

This MR ensures that we check for the access token creation policy is enabled before showing the Suggested Reviewers setting as well as prior to invoking the registration worker.

The client-facing feature is behind a feature flag suggested_reviewers_control and is disabled by default.

Screenshots or screen recordings

Screen_Shot_2022-10-19_at_10.37.28_pm

How to set up and validate locally

  1. Ensure a SaaS (Gitlab.com) environment
    1. One way of doing this is to add a env.runit file to the root GDK folder with the following snippet
      export GITLAB_SIMULATE_SAAS=1
  2. Set ultimate license on a group http://gdk.test:3000/admin/groups
  3. Create a project in the ultimate group or use an existing one, e.g. http://gdk.test:3000/gitlab-org/gitlab-test
  4. Set the feature flag on rails console bundle exec rails c
    project = Project.find(2)
    Feature.enable(:suggested_reviewers_control, project)
  5. Navigate to Project > Settings > Merge requests and verify that we can see the Suggested Reviewers setting
  6. Navigate to Group > Settings > General, expand Permissions and group features and turn off Allow project and group access token creation.
  7. Navigate to Project > Settings > Merge requests and verify that we no longer can see the Suggested Reviewers setting

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #377917

Edited by Tan Le

Merge request reports