Skip to content

Notify admins 15 days prior to license expiration

What does this MR do and why?

Related to #337250 (closed)

As stated in #337250 (closed), the subscription expiration banner was being shown to SM Admins up to a month before the license expiration. However, SM customers aren't able to renew their subscriptions until 15 days prior to expiration (or later). This led to some understandable confusion from customers where the warning didn't align with the call to action.

The agreed solution was to align the admin notification timing with the renewal ability (15 days prior). It was found that the admin and user notification windows is actually set by 2 attributes in the Gitlab::License object. IOW, the timing was being driven by the license key and not logic in the GitLab codebase. We decided to change this so that GitLab has this notification logic and we will remove the attributes from the Gitlab::License class as it was unnecessary.

In this MR, the notification method, notify_admins?, in Gitlab::License is overridden so that admins are notified only 15 days prior to license expiration. Similarly, the notification method, notify_users?, is overridden for consistency. This will allow us to remove these methods from Gitlab::License at some point in the future.

Screenshots or screen recordings

Example of expiring license admin notification

Screen_Shot_2022-01-05_at_4.41.40_PM

Example of expired license admin notification

Screen_Shot_2022-01-05_at_4.42.52_PM

How to set up and validate locally

I was able to test this by uploading license keys under various conditions. Here's the procedure I followed:

  1. Generate a license key manually using CustomersDot Admin, http://localhost:5000/admin/license/new_license
  2. Upload the license key in the SM instance, http://localhost:3000/admin/license/new
  3. Visit any page to see the notification. You can visit as an admin or a regular user to see various scenarios.

Examples:

  • Upload a license that expires in 2 days; see that the notification banner shows for Admins but not for Users.
  • Upload a license that expires in 16 days; see that no notification banner shows for Admins or Users.
  • Upload a license that expired 2 days ago; see that the expired notification banner shows for Admins but not Users.
  • Upload a license that expired more than 2 weeks ago; see that the expired notification banner shows for both Admins and Users.

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 Tyler Amos

Merge request reports