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

source_xid

How to set up and validate locally

  1. Feature.enable(:bulk_import)
  2. Feature.enable(:bulk_import_projects)
  3. Create a group with a project in it
  4. Navigate to /groups/new#import-group-pane & enter gdk instance url & password
  5. Select a group your created to be migrated under a new destination/name
  6. Wait for migration to be complete & verify group & project are still migrated
  7. Verify rows in bulk_import_entities table have source_xid set

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by George Koltsov

Merge request reports

Loading