Registry phase 2 migration: New APIs required for the migration
Context
The context for this issue can be viewed in the epic &7316 (closed) and the breakdown of work can be viewed in this comment &7316 (comment 792633854).
We decided to make a unified endpoint PUT /api/:version/internal/registry/repositories/:path/migration/status that will consume the request body as defined in the import notification endpoint.
{
"name": "gitlab-container-registry",
"path": "gitlab-org/build/cng/gitlab-container-registry",
"status": "imported",
"detail": "import completed successfully"
}
The possible statuses are defined in container-registry#510 (closed)
📻 API changes
New endpoint: PUT /api/:version/internal/registry/repositories/:path/migration/status
-
backend tasks:
- Check for authentication
- Only requests with the Container Registry secret are allowed.
- Check for migration
statuscoherence - If current status is
pre_import_complete:- Execute
container_repository.finish_pre_import - Execute
container_repository.start_import
- Execute
- If current status is
imported:- Execute
container_repository.finish_import - Log all the
migration_*timestamps
- Execute
- Check for authentication
- Possible response codes:
-
200 OKEverything is fine. -
400 BadRequestif called for a container repository that is not in the right migration state with a body similar to this one:{ "message": "400 Bad request - Wrong migration state(<current migration state>) for status <status value sent> } -
401 Unauthorizedif the secret is missing.
-
Edited by David Fernandez