Fix group name conflict when migrating groups via BulkImport
What does this MR do and why?
Namespaces cannot have subgroups with the same name, so when importing a group into a preexisting namespace, we need to guarantee that the imported group won't have a name that conflicts with a preexisting group.
This change modifies the BulkImports::Groups::Transformers::GroupAttributesTransformer
to append a counter to the source group name in case the name conflicts with another subgroup of the namespace.
Related to: GitLab Importer fails to import when importing ... (#362954 - closed)
Describe in detail what your merge request does and why.
Screenshots or screen recordings
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
-
Feature.enable(:bulk_import)
. - Create a top-level group with the name "Group A".
- Create another top-level group and create a subgroup with the name "Group A"
- Go to the
/groups/new#import-group-pane
page and enter the instance URL and access token (needs to beAPI
&read_repository
scope). - Import the first top-level group into the second top-level group.
- Wait for group import to complete and verify that the first top-level group was imported as a subgroup in the second top-level group but with the name "Group A(1)"
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.