Skip to content

Update true-up validation for Cloud Licenses

What does this MR do and why?

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

Prior to this change, true-ups could lead to issues when the license is a Cloud License.

Now, the true-up validation logic was updated. It will still run as before for Legacy Licenses. When the license is a Cloud License, there are additional checks that have to be met in order for the validation to be executed:

  • It has to have Reconciliations enabled
  • The last synced at timestamp is missing OR it is older than 3 months

Note: This assumes that licenses have a term of 12 months.

How to set up and validate locally

  1. You have to create a new Legacy License in CustomersDot that meets the following:
    • The license is valid from today (starts_at) until a year from now (expires_at).
    • In your GitLab rails console, look up the historical max for the year prior to the license's term: HistoricalData.max_historical_user_count(from: (expires_at - 2.years).beginning_of_day, to: (expires_at - 1.year).end_of_day). In my case that was 52.
    • Create a Legacy License with the above user count, fill in previous user count with a smaller number (in my case 45), fill in the true-up case with a number that doesn't add up match user count - previous user count (in my case 3).
  2. Upload the license in your GitLab instance under /admin/application_settings/general.
  3. You should see an error that you need a higher true-up count (in my case: I applied one for 3 but needed 7).
  4. Duplicate the created license and make the new license an Offline Cloud License (you'll need a subscription to link it to).
  5. Go to your CustomersDot's rails console and modify the license to include a last synced at timestamp: license = License.last; license.last_synced_at = Time.current.to_datetime; license.send(:generate_license_file)
  6. Upload the license in your GitLab instance.
  7. You should see that it works without an error.

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

Loading