API Route for repository Migration
Context
As part of the gradual migration plan, the registry will expose a new route which will start the migration of a repository. This route will be used by rails, which will be responsible for coordinating the migration.
Features
Import
The import endpoint starts an Import, or optionally, a pre-import. It is the caller's responsibility to check the number of tags in the repository before initiating import, since this route may take some seconds to return. The registry should define a configurable limit of tags that it will allow to be imported, to prevent serving import requests against very large repositories.
PUT gitlab/v1/repositories/migrate/<name>
Success
-
201 — CreatedSuccessful Migration -
200 — OKAlready migrated
Errors
-
400 — Bad RequestRepository contains too many tags to import. TODO: communicate this information back to the caller -
409 — ConflictRepository is already being imported -
424 — Failed DependencyRepository failed to pre import -
425 — Too EarlyRepository is currently being pre imported -
401 UnauthorizedThe client should take action based on the contents of theWWW-Authenticateheader and try the endpoint again. -
404 Not FoundThe repository was not found.
Pre Import
PUT gitlab/v1/repositories/migrate/<name>?preimport=true
Success
-
202 — AcceptedPre Import Started -
200 — OKAlready migrated
Errors
-
409 — ConflictRepository is already being imported or pre imported -
401 UnauthorizedThe client should take action based on the contents of theWWW-Authenticateheader and try the endpoint again. -
404 Not FoundThe repository was not found.
Status and Notification
Status via Inbound HTTP Request
This import returns the migration status of the repository, as described in #510 (closed)
GET gitlab/v1/repositories/migrate/<name>
Success
-
200 — OKSuccessfully retrieved migration status
Errors
-
401 UnauthorizedThe client should take action based on the contents of theWWW-Authenticateheader and try the endpoint again. -
404 Not FoundThe repository was not found.
Status via Webhook Notification
This strategy would use webhook notifications to signal to Rails once a repository is successfully pre imported as described in #374 (closed)
Without #335 (closed) these notifications will not be 100% reliable.
Status via Outbound HTTP Request
This strategy would use an HTTP request sent from the registry to signal to Rails once a repository is successfully pre imported as described in #374 (closed)
Cancellation via HTTP Request
DELETE gitlab/v1/repositories/migrate/<name>
This endpoint would serve to stop and abandon an import or pre import
Success
-
200 — OKAlready migrated -
202 — AcceptedSuccessful cancellation
Errors
-
401 UnauthorizedThe client should take action based on the contents of theWWW-Authenticateheader and try the endpoint again. -
404 Not FoundThe repository was not found.
Open Questions
- How many background workers per registry instance should be able to be active at once?