Execute auto Duo Pro seat assignment async
What does this MR do and why?
Part of https://gitlab.com/gitlab-org/gitlab/-/issues/465834+
Prior to this change, the auto seat assignment for a Duo Pro seat was done in sync after adding a new member to a group. For larger namespaces this could cause possible performance issues.
This change moves the auto Duo Pro seat assignment to a worker that is executed async.
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.
Screenshots or screen recordings
This should still be the same as the original logic shown here but via an async (it was processed quickly for me).
How to set up and validate locally
-
GitLab: Make sure you have the following feature flags enabled:
hamilton_seat_management
auto_assign_gitlab_duo_pro_seats
- GitLab: Create a new group.
- Either use CustomersDot, Zuora or mock the purchase for this step:
- Purchase a Premium or Ultimate subscription including some Duo Pro add-on seats for the created group:
- Zuora: Make sure to enter the group info during the subscription creation.
- CustomersDot: You'll need to purchase the Premium/Ultimate subscription first and then purchase the Duo Pro add-on in another step (via the subscription card).
-
GitLab: Execute the following logic in your rails console:
namespace = YOUR_NAMESPACE add_on = GitlabSubscriptions::AddOn.find_or_create_by!(name: "code_suggestions") {|e| e.description = "Test"} add_on_purchase = GitlabSubscriptions::AddOnPurchase.create!( add_on: add_on, namespace: namespace, expires_on: 1.month.from_now, quantity: 5, purchase_xid: 'A-S0001')
- Purchase a Premium or Ultimate subscription including some Duo Pro add-on seats for the created group:
- ZSim/CustomersDot: Skip if the above step was done by mocking the purchase in GitLab directly. Otherwise, process the callout.
-
GitLab: Visit the Duo Pro usage quotas page for the group (group page ->
Settings
->Usage Quotas
->GitLab Duo
tab). - GitLab: You should see your logged in user listed there.
-
GitLab: Visit the group's members page (group page ->
Manage
->Members
). -
GitLab: Click on the
Invite members
on the upper right corner. - GitLab: Invite two other users.
- GitLab: Go back to the Duo Pro usage quotas page.
- GitLab: Verify that both users were auto assigned a seat.