Update GitLab Migration to use source_id when requesting relations export
What does this MR do and why?
We've recently added a new column source_xid to bulk_import_entities table, in order to utilize it's value when making a network request to source GitLab instance to export project/group relations, as part of GitLab Migration feature.
The idea is to make a network request to /api/v4/groups/12345/export_relations instead of /api/v4/groups/group_full_path/export_relations in order to avoid a potential lookup clash, when full path is used, as a user can have a group with all numerical full path (e.g. 5000). In this case, our REST API treats and resolves it as integer id instead of string full_path. In order to avoid this problem, we now store source_xid in the database for future use, instead of relying on full_path.
This MR updates BulkImports::ExportRequestWorker in order to try update the corresponding entity source_xid if it is missing, in order to make a network request with id instead of full path. If that fails, fallback on using full path instead.
Screenshots or screen recordings
How to set up and validate locally
Feature.enable(:bulk_import)Feature.enable(:bulk_import_projects)- Create a group with a project in it
- Navigate to
/groups/new#import-group-pane& enter gdk instance url & password - Select a group your created to be migrated under a new destination/name
- Wait for migration to be complete & verify group & project are still migrated
- Verify rows in
bulk_import_entitiestable havesource_xidset
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.