Skip to content

export groups recursive and import them one-by-one under correct name and path

Felix Dörre requested to merge felix.doerre/migration:recursive into main

Hello,

You recommended this script to me, to migrate our repositories, since the gitlab-internal transfer fails. The script was not usable as-is due to a number of shortcomings, but it was a good starting point.

I'll summarize the issues and share the now heavily modified script in the hopes that it helps others who want to migrate their groups. To use this script it is expected to transfer the group structure (without projects) first using the native functionality, and then use this script to import all projects. If desired, one could also include that initial transfer via API.

Issues that I needed to fix:

  • The folder exported_files is expected but not created automatically
  • The project requires tqdm although that was not specified before
  • TLS verification was disabled
  • Projects are re-imported under different names/paths based on the exported filenames -> the projects are now re-imported directly one-by-one with the correct path and name, so they don't need to be "stored" in file names
  • Recursion: Our group consists of multiple subgroups and repos, so it is necessary to also migrate all repositories in subgroups
  • Sane waiting: Although the code that actively waits for exports is commented out, it just needed small tweaking to work flawlessly for me. I think it should now work for all.
  • Adjust project creation permissions: Something disabled the "create project in this subgroup"-Permission in the source gitlab. This restriction is copied over to the new gitlab, when the structure is transferred. However it prevents importing the projects. I believe this is also the reason that the native "transfer groups with projects" fails. When such a situation is encountered, I will adjust the privileges.

Feel free to merge this, or, if you want, we could have this as an alternative script next to the original one.

Merge request reports

Loading