Create add-on purchases when applying an offline license
Part of https://gitlab.com/gitlab-org/gitlab/-/issues/475016+
Prior to this change, add-on purchases were only created for online cloud licenses during an instance activation or the daily/manual seat sync.
This change provisions and deprovisions add-on purchases when applying an offline license as well. The deprovisioning is also already part of the logic to destroy a license and doesn't require additional changes.
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
- Create a new subscription in Zuora with the following configuration:
-
Turn on Cloud Licensing
is set tooffline
. - Add the
Self-Managed - Premium - 1 Year
product with sufficient seats to cover at least your active users on your GL instance. - Add the
Self-Managed - GitLab Duo Pro - 1 Year
product with a couple of seats.
-
- Process the Zuora callout.
- Copy the created license's license key (you can find it in the email via letter opener or call the last created
License
in your CustomersDot rails console). - Apply the license on your GL instance under
admin/application_settings/general
in theAdd License
section. - The license should be successfully applied to your GL instance.
- Open a rails console for your GL instance and check that the add-on purchase record for code suggestions/Duo Pro was successfully created as well with the following code:
GitlabSubscriptions::AddOnPurchase.where(namespace_id: nil)
- Remove the license from your GL instance.
- Verify the add-on purchase was updated to have expired yesterday.
Edited by Corinna Gogolok