Create Rake Task to Bulk Assign Duo Seats

What does this MR do and why?

This MR introduces a new Rake task to bulk assign users to GitLab Duo Pro or Enterprise seats for both Self-managed instances and GitLab.com namespaces.

This task is similar to the existing task duo_pro:bulk_user_assignment, which only supports Duo Pro seat assignments. We originally planned to update this to support both Duo Pro and Enterprise, however, changing the name and inputs for this task would introduce a breaking change for customers that may still use this. We have instead decided to introduce a new task, with a plan to deprecate the old task as part of this issue.

References

Screenshots or screen recordings

N/A

How to set up and validate locally

Self-managed

Expand for testing steps
  1. Set up your GDK instance for Self-managed mode, ex:

gdk.yml (for local CustomersDot):

license:
  customer_portal_url: http://localhost:5000
  license_mode: test

gdk.yml (for CustomersDot Staging):

license:
  customer_portal_url: https://customers.staging.gitlab.com
  license_mode: test
  1. Purchase a self-managed license with a Duo Pro or Enterprise add-on via CustomersDot
  2. Activate your GDK instance with the activation code
  3. Create a CSV file with a list of usernames on your GDK instance, following this format:
username
user1
user2
user3
etc...
  1. Run the Rake task:
bundle exec rake gitlab_subscriptions:duo:bulk_user_assignment DUO_BULK_USER_FILE_PATH=path/to/your/file.csv
  1. Verify the users have been assigned GitLab Duo seats as expected by visiting the Admin > GitLab Duo page

Gitlab.com

Expand for testing steps
  1. Set up your GDK instance for SaaS mode, ex:

gdk.yml (for local CustomersDot):

license:
  customer_portal_url: http://localhost:5000

env.runit:

export GITLAB_SIMULATE_SAAS=true
  1. Ensure you have ZSim running and listening for callouts
  2. Create a new top-level group and invite members to it
  3. Purchase a SaaS subscription with a Duo Pro or Enterprise add-on for the group
  4. Create a CSV file with a list of usernames for the members of your group, following this format:
username
user1
user2
user3
etc...
  1. Run the Rake task:
    • Important: Make sure the terminal you run this Rake task from also has GITLAB_SIMULATE_SAAS=true to help satisfy the condition gitlab_com_subscription?. For actual GitLab.com instances like Staging and Production, this will not be needed (see underlying check for Gitlab.com?)
bundle exec rake gitlab_subscriptions:duo:bulk_user_assignment DUO_BULK_USER_FILE_PATH=path/to/your/file.csv NAMESPACE_ID=<group_id>
  1. Verify the users have been assigned GitLab Duo seats as expected by visiting your group's Settings > GitLab Duo page

MR acceptance checklist

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

Related to #500153

Edited by Valerie Burton

Merge request reports

Loading