Skip to content

Handle code suggestions add-on purchase in licenses

Corinna Gogolok requested to merge 419944_manage_add_on_purchase_in_license into master

What does this MR do and why?

Part of https://gitlab.com/gitlab-org/gitlab/-/issues/419944+

When a license for an Online Cloud subscription is used as the current license and it contains a code suggestions add-on purchase, the needed data for the code suggestions add-on purchase will now be created. This happens when an activation code is used for such a license or when a license seat link is triggered for one.

Additionally, when a license is created and the current is for an Online Cloud subscription a new seat link sync is scheduled to retrieve up to date data for the license. The sync will update the future subscriptions info and the code suggestions add-on purchases.

How to set up and validate locally

note: You'll need Zuora, CustomersDot and GitLab/GDK for this verification:

  1. Zuora: Create a new self-managed subscription with TurnOnCloudLicensing set to Yes in Zuora.
  2. CustomersDot: Wait for the callout to process.
  3. CustomersDot: Copy the activation code (either from the email in letter opener or by querying for CloudActivation.last.activation_code) and activate your GitLab instance (you'll need this in a later step).
  4. Zuora: Start to create a new self-managed subscription with TurnOnCloudLicensing set to Yes in Zuora.
  5. Zuora: Add code suggestions as an additional product to the same subscription and enter a much smaller quantity than the subscription's seats.
  6. Zuora: Activate the subscription.
  7. CustomersDot: Wait for the callout to process.
  8. CustomersDot: Copy the activation code (either from the email in letter opener or by querying for CloudActivation.last.activation_code) and activate your GitLab instance.
  9. GitLab: Open a rails console and verify the last GitlabSubscriptions::AddOnPurchase record reflects the correct data of your subscription from steps 4-6: GitlabSubscriptions::AddOnPurchase.last
  10. Repeat steps 4-9.
  11. GitLab: Remove the license in under admin/subscription.
  12. Verify the last GitlabSubscriptions::AddOnPurchase was updated to reflect the data from the subscription created in steps 4-6.
  13. GitLab: Remove the next license too in under admin/subscription.
  14. Verify the last GitlabSubscriptions::AddOnPurchase was updated to be expired as of yesterday.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Corinna Gogolok

Merge request reports