Allow renaming/moving of origin repository through GitlabAPIClient
🌳 Overview
In #475000 (closed), we add a new feature to ContainerRegistry#GitlabAPIClient to enable the moving of the base repository.
In this issue, we then use that new feature to enable transferring groups or projects with container repository tags within the same top-level namespace.
Today, we block transferring groups or projects with container repository tags. And there are multiple places where we block them:
Groups::UpdateServiceGroups::TransferServiceProjects::TransferService
Using the new method added to GitlabApiClient in #475000 (closed), we can then enable the transfer.
Note that the transfer is only allowed within the same top-level namespace, otherwise an error should be raised. There is also a dry_run parameter that we can harness to validate if the operation can succeed.
🌱 Implementation Plan
NOTE: Only available when the GitlabAPI is available.
- In the above classes, we revisit the errors added when there are existing container repository tags.
- We start to add an if/else: if it's not the top level namespace being changed AND if a dry run succeeds (otherwise add another error), we allow it to continue, otherwise, maintain the existing error.
- When no other errors are present, execute the API call through
GitlabAPIClient
🎋 Docs Update
Update the documentation where we note that moving the project with registry tags is already allowed (i.e. https://docs.gitlab.com/ee/user/project/settings/migrate_projects.html#transfer-a-project-to-another-namespace)