Create new compute_minutes internal API route
What does this MR do and why?
This MR creates a new internal API route for compute minutes to follow the new PATH format: '/internal/gitlab_subscriptions/...'
.
It copies the existing code from API::Ci::Minutes and its corresponding spec, almost verbatim.
The older endpoint will be deprecated and removed in #473625.
Related to Issue: #463741+
Corresponding MR on CDot
: https://gitlab.com/gitlab-org/customers-gitlab-com/-/merge_requests/11138
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
Start the GDK and CustomersDot.
-
GitLab: Find the ID of a top level namespace
-
CustomersDot: Start a rails console
-
CustomersDot console: verify the new API endpoint still works
# create the a CI minutes pack [1] pry(main)> Client::GitlabApp.post("/api/v4/internal/gitlab_subscriptions/namespaces/416/minutes", **Gitlab::Api::Internal::Authentication.token, body: { packs: [ { number_of_minutes: 10_000, expires_at: 1.year.from_now.to_s, purchase_xid: SecureRandom.hex(16) } ] }) => [{"namespace_id"=>416, "expires_at"=>"2025-10-17", "number_of_minutes"=>10000, "purchase_xid"=>"0e86765780dc9990a56de734b6296558"}]
-
GitLab console: check that the pack was created
[1] pry(main)> Ci::Minutes::AdditionalPack.last => #<Ci::Minutes::AdditionalPack:0x00000001644d0c28 id: 30, namespace_id: 416, expires_at: Fri, 17 Oct 2025, number_of_minutes: 10000, purchase_xid: "0e86765780dc9990a56de734b6296558">
-
CustomersDot console: Migrate the packs to new namespace
# transfer a CI minutes pack to another top level namespace [2] pry(main)> Client::GitlabApp.patch("/api/v4/internal/gitlab_subscriptions/namespaces/416/minutes/move/415", **Gitlab::Api::Internal::Authentication.token) => {"message"=>"202 Accepted"}
-
GitLab console: verify that packs was transferred to correct namespace
[2] pry(main)> Ci::Minutes::AdditionalPack.last => #<Ci::Minutes::AdditionalPack:0x000000016473b418 id: 30, namespace_id: 415, expires_at: Fri, 17 Oct 2025, number_of_minutes: 10000, purchase_xid: "0e86765780dc9990a56de734b6296558">