Allow Suggested Reviewers registration for access tokens
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
How to set up and validate locally
- Ensure a SaaS (Gitlab.com) environment
- One way of doing this is to add a
env.runit
file to the root GDK folder with the following snippetexport GITLAB_SIMULATE_SAAS=1
- One way of doing this is to add a
- Set ultimate license on a group
http://gdk.test:3000/admin/groups
- Create a project in the ultimate group or use an existing one, e.g.
http://gdk.test:3000/gitlab-org/gitlab-test
- Set the feature flag on rails console
bundle exec rails c
project = Project.find(2) Feature.enable(:suggested_reviewers_control, project)
- Navigate to Project > Settings > Merge requests and verify that we can see the Suggested Reviewers setting
- Navigate to Group > Settings > General, expand
Permissions and group features
and turn offAllow project and group access token creation.
- 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.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #377917