Skip to content

Render manual quarterly co-term banner

What does this MR do and why?

Part of https://gitlab.com/gitlab-org/gitlab/-/issues/346260

Depends on !76255 (merged) to be merged first

This change will use the logic that was introduced in !76255 (merged) to render the manual quarterly co-term banner.

The banner will only be displayed for customers with a self-managed cloud license but have restricted internet access that prevents their instance to do the quarterly co-term automatically and have to take manual action. The condition to determine an offline customer is still under discussion though and therefore not added yet. Since the feature is behind a feature flag, the missing condition can be added at a later time.

The banner will show up for upcoming quarterly co-terms within the next 14 days (notification window) or for overdue quarterly co-terms.

To see the banner, the customer has to be logged in as an admin and can see the banner on the admin dashboard (/admin) and the subscription page (/admin/subscription).

Please see the issue for more information.

Screenshots or screen recordings

scenario screenshot
upcoming within notification period on admin dashboard (/admin) dash_upcoming
overdue on admin dashboard (/admin) dash_overdue
upcoming within notification period on subscription page (/admin/subscription) sub_upcoming
overdue on subscription page (/admin/subscription) sub_overdue

How to set up and validate locally

  1. Start a rails console.
  2. Enable the feature flag: Feature.enable(:automated_email_provision).
  3. Make sure that Gitlab::CurrentSettings.check_namespace_plan? returns false or you won't be able to create a new record GitlabSubscriptions::UpcomingReconciliation record later.
  4. If it returns true, do ApplicationSetting.first.update(check_namespace_plan: false).
  5. Check if you already have a GitlabSubscriptions::UpcomingReconciliation record: reconciliation = GitlabSubscriptions::UpcomingReconciliation.next.
  6. If one exists, update it to display the banner: date = 14.days.from_now; reconciliation.update(next_reconciliation_date: date, display_alert_from: date - 7.days)
  7. If none exists, create one: date = 14.days.from_now; reconciliation = GitlabSubscriptions::UpcomingReconciliation.create!(next_reconciliation_date: date, display_alert_from: date - 7.days)
  8. Visit your GitLab instance in the browser.
  9. Log into the admin area and make sure you are on /admin.
  10. See the banner in the yellow version of the banner on /admin and on /admin/license.
  11. Go back to your rails console.
  12. Update the reconciliation record from above to be overdue: date = Date.yesterday; reconciliation.update(next_reconciliation_date: date, display_alert_from: date - 7.days)
  13. Go back to your browser.
  14. See the banner in the red version of the banner on /admin and on /admin/license.

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