Skip to content

WIP: Add support to process info about GitLab.com subscriptions

What does this MR do?

  • Adds a new model: GitlabSubscription

    • This model will be used to store all the info related to a GitLab.com subscription or a GitLab EE subscription.
  • Adds the following API endpoints

    • POST https://gitlab.example.com/api/v4/namespaces/:id/gitlab_subscription
      • This endpoint creates a new GitLab subscription for the current namespace (can be a Group or User).
      • This endpoint can be used only with an admin token. For now this is only going to be used by the subscription portal every time a new subscription is purchased. The subscription portal will sync all the info related to the subscription: the number of purchased seats, the purchased plan, start and end date of the subscription and whether the subscription is trial or not.
    • GET https://gitlab.example.com/api/v4/namespaces/:id/gitlab_subscription
      • Returns the serialized GitLab Subscription resource that belongs to the current namespace. This endpoint can only be accessible by the owner of the namespace or the admin user.
    • PUT https://gitlab.example.com/api/v4/namespaces/:id/gitlab_subscription
      • This endpoint allows the client to update any attribute of the GitLab subscription resource.
  • Adds a new background job that will be executed daily through a cronjob.

    • The purpose of this worker is to update the max_seats_used attribute of the GitLab subscription with the current number of active users. max_seats_user is only going to be updated if the current number of active users is greater than the current value of max_seats_used
    • The value of max_seats_used will be used to show the customer how many extra seats they have added on top of the seats allowed by the subscription. Our plan is to do an automatic charge of those extra seats on a monthly basis.

What are the relevant issue numbers?

Closes #7438 (closed)

Does this MR meet the acceptance criteria?

Edited by Rubén Dávila

Merge request reports