Skip to content

Add service and client to deregister Suggested Reviewers projects

Tan Le requested to merge 393147-deregister-suggested-reviewers-projects into master

What does this MR do and why?

This MR introduces a service and client to deregister projects from Suggested Reviewers. This allows projects to be removed from merge requests data extraction as well as other metadata stored on the Suggested Reviewers side.

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

Components highlighted in #e9967a are part of this MR.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

  1. Set ultimate license on a group http://gdk.test:3000/admin/groups
  2. Create a project in the ultimate group or use an existing one, e.g. http://gdk.test:3000/gitlab-org/gitlab-test
  3. Start rails console bundle exec rails c
  4. Enable SAAS simulation and create a random secret
    ENV['GITLAB_SIMULATE_SAAS'] = '1'
    ENV['SUGGESTED_REVIEWERS_SECRET'] = SecureRandom.hex(32)
  5. Set the feature flag
    project = Project.find(2)
    Feature.enable(:suggested_reviewers_control, project)
  6. Disable the suggested reviewers setting
    project.project_setting.update(suggested_reviewers_enabled: false)
    project.reload
  7. Invoke the service and observe the response object (failure is due to the Suggested Reviewers service is not configured).
    user = User.first
    service = ::Projects::DeregisterSuggestedReviewersProjectService.new(project: project, current_user: user)
    service.execute
    => #<ServiceResponse:0x000000016810fc20 @http_status=nil, @message="Failed to deregister project", @payload={}, @reason=:client_request_failed, @status=:error>

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 #393147 (closed)

Edited by Tan Le

Merge request reports

Loading