BulkImports: avoid infinity recursion on group migration
What does this MR do?
The current subgroup migration strategy works iteratively, which means that each level of a group tree is imported before moving to the next level.
This becomes a problem when the target group is within the source group, which creates a infinity loop of import.
Example:
Given a group tree like:
- Group A
- Group B
- Group C
- Group X
- Group Y
If one decide to import the Group A into Group B, a recursion will happen, making the import stop only when the depth limit is achieved or some other database constraint, like the size of a group path.
- Group A
- Group B
- Group A
- Group B
- Group A
- Group B
- Group A
- Group B
- ...
- Group C
- Group X
- Group Y
- Group B
- Group A
- Group C
- Group X
- Group Y
- Group B
- Group A
- Group C
- Group X
- Group Y
- Group B
- Group A
- Group C
- Group X
- Group Y
- Group B
To fix that, destination namespaces cannot be a descendant of the source group.
Related to: #300445 (closed)
Update (2021-02-01)
- There's a follow-up issue (#300684 (closed)) to bubble up the error to the UI. (based on !52931 (comment 498371156))
Screenshots (strongly suggested)
Screen_Recording_2021-01-28_at_6.20.42_PM
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry - [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines - [-] Style guides
- [-] Database guides
- [-] Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team