Skip to content

Deregister suggested reviewers project via worker

What does this MR do and why?

This MR allows project admins to deregister projects from Suggested Reviewers by disabling the corresponding project setting. The deregistration action is performed asynchronously via a background job.

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

  • Components highlighted in #e9967a are part of this MR.
  • The ProjectService and Client have been completed as part of !112916 (merged).

Screenshots or screen recordings

The Suggested Reviewers setting is accessible via Project Settings > Merge request

Screen_Shot_2022-11-09_at_10.33.00

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. Start rails console bundle exec rails console
  5. Set the feature flag
    project = Project.find_by_full_path('gitlab-org/gitlab-test')
    Feature.enable(:suggested_reviewers_control, project)
  6. Go to the merge request settings for the project (e.g. http://gdk.test:3000/gitlab-org/gitlab-test/-/settings/merge_requests)
  7. Disable the suggested reviewers, after an enabled state
  8. Observe some failed workers in the Sidekiq logs (due to lack of authentication) and some failed jobs in admin panel
    $ gdk tail rails-background-jobs | grep --line-buffered DeregisterSuggestedReviewersProjectWorker
    2023-03-07_06:26:41.76818 rails-background-jobs : {"severity":"INFO","time":"2023-03-07T06:26:41.767Z","retry":3,"queue":"default","backtrace":true,"version":0,"args":["1","1"],"class":"Projects::DeregisterSuggestedReviewersProjectWorker","jid":"d54102b7116e00049ce19948","created_at":"2023-03-07T06:26:41.764Z","correlation_id":"01GTXC0AT8XZ0SH54HYZNG3C43","meta.caller_id":"Projects::Settings::MergeRequestsController#update","meta.remote_ip":"172.16.123.1","meta.feature_category":"workflow_automation","meta.user":"root","meta.user_id":1,"meta.project":"gitlab-org/gitlab-test","meta.root_namespace":"gitlab-org","meta.client_id":"user/1","meta.root_caller_id":"Projects::Settings::MergeRequestsController#update","worker_data_consistency":"always","idempotency_key":"resque:gitlab:duplicate:default:faec4cb477afa202d1d65c00426a73a1a699b4cc9d61bde15d7da3b731728884","size_limiter":"validated","enqueued_at":"2023-03-07T06:26:41.766Z","job_size_bytes":5,"pid":49719,"message":"Projects::DeregisterSuggestedReviewersProjectWorker JID-d54102b7116e00049ce19948: start","job_status":"start","scheduling_latency_s":0.001021}

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