feat: force final import cancelation
Problem
Currently, an ongoing final import can be canceled manually only when the current status is import_in_progress. Once the import completes without errors, the status is set to import_complete. Once the status is set to import_complete, incoming requests for that repository will start being served by the new code path.
During the .com phase 2 rollout, it would be handy to have a way to manually force a completed import to be considered as failed. This would be exclusively used as an emergency tool (with admin rights only) if we find out that an unexpected problem occurred while importing a repository and no errors were raised. Overriding an import_complete status with import_failed will cause requests to be routed through the old code path again, giving us time to debug what happened without impacting users.
Solution
We should add a flag to the delete API endpoint such as DELETE /gitlab/v1/import/<path>/?force=true that will override an import_complete status with import_failed. We should also set the migration_error to something unique, e.g. forced cancelation.
We can check the query param on before this line https://gitlab.com/gitlab-org/container-registry/-/blob/dec12e3b9ad04284a10aaf622fdc0d459834dd19/registry/handlers/import.go#L467 and call ih.cancelImport immediately.