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 — Created Successful Migration
  • 200 — OK Already migrated

Errors

  • 400 — Bad Request Repository contains too many tags to import. TODO: communicate this information back to the caller
  • 409 — Conflict Repository is already being imported
  • 424 — Failed Dependency Repository failed to pre import
  • 425 — Too Early Repository is currently being pre imported
  • 401 Unauthorized The client should take action based on the contents of the WWW-Authenticate header and try the endpoint again.
  • 404 Not Found The repository was not found.

Pre Import

PUT gitlab/v1/repositories/migrate/<name>?preimport=true

Success
  • 202 — Accepted Pre Import Started
  • 200 — OK Already migrated
Errors
  • 409 — Conflict Repository is already being imported or pre imported
  • 401 Unauthorized The client should take action based on the contents of the WWW-Authenticate header and try the endpoint again.
  • 404 Not Found The 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 — OK Successfully retrieved migration status
Errors
  • 401 Unauthorized The client should take action based on the contents of the WWW-Authenticate header and try the endpoint again.
  • 404 Not Found The 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 — OK Already migrated
  • 202 — Accepted Successful cancellation

Errors

  • 401 Unauthorized The client should take action based on the contents of the WWW-Authenticate header and try the endpoint again.
  • 404 Not Found The repository was not found.

Open Questions

  • How many background workers per registry instance should be able to be active at once?
Edited by Hayley Swimelar