Skip to content

Draft: Spike: test runtime for bulk assigning 10k Duo Pro seats

What does this MR do and why?

Spike for https://gitlab.com/gitlab-org/fulfillment/meta/-/issues/1488+. Builds upon Draft: [WIP] Spike - Enhanced Bulk Assignment API (!136537 - closed).

This MR tests the feasibility of bulk assigning Duo Pro seats, by hardcoding the user IDs to be assigned through the userAddOnAssignmentBulkCreate and userAddOnAssignmentBulkRemove GraphQL endpoints.

GraphQL

Please see the same section in !136537 (closed) for the endpoints' query and variable format.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

How to set up and validate locally

To run a similar test on your local machine, replace the user IDs as highlighted in the changes.

You can mass-create an arbitrary number of users on your local machine by running the following commands in your rails console:

ns = Namespace.find(<namespace_id>) # Add the namespace ID that the users should be created and assigned to
new_users_length = 10_000 # Change this if you want more or less users

first_user_id = User.last.id + 1

# Bulk create users
new_users_length.times do |i|
  User.create!(
    email: "<gl_username>+sampleuser#{i}@gitlab.com", # add your gitlab username here
    password: '<password>', # add a (dummy) password
    username: "sampleuser#{i}",
    name: "Sample user #{i}",
    namespace: ns
  )
end

# Retrieve created users
users = User.find(*first_user_id..(first_user_id+new_users_length-1))

Members::Groups::CreatorService.add_members(
  ns,
  users,
  Gitlab::Access::DEVELOPER, # change access level according to preference
  current_user: User.find(<group_owner_id>)) # add group owner ID here

Merge request reports