3

we are migrating from self hosted gitlab to gitlab.com subscription. We have parent 28 group and under these groups there are multiple subgroups and projects.

I know I can export one group and it will export all the subgroups under it and then I can import it.

but documentation says to export/import single project at a time. I have almost 3000+ Projects and doing this things 3000+ time is not possible.

Can you please suggest me How can I export/import all the projects under a group regardless it is in a group or under someother subgroup in hierarchy ?

or is there any other way ?

torek
  • 448,244
  • 59
  • 642
  • 775
Aman35
  • 39
  • 1
  • 5

1 Answers1

0

You will need to write scripts that interact with the GitLab API to perform the migration of groups/orgs, projects, branches, and merge requests. See the following post on GitLab's forum for guidance.

Richard
  • 2,226
  • 2
  • 19
  • 35
  • I have 2500 projects and most of the projects are under another subgroups .. I am clueless how to pass these paths/Urls to script for gitlab import/export API. What I understood is .. git project IDs for loop for those ids which will use export API to to export the projects.. Please correct me if I am wrong ? – Aman35 May 18 '22 at 20:12
  • Yeah. You have the right idea. Break the problem into smaller, easier-to-solve problems. Is there a programming language that you are comfortable with? – Richard May 18 '22 at 20:30
  • I am using following script to extract the project IDs of a group and all subgroups under this group and then using those Ids to start the export.. curl --header "PRIVATE-TOKEN: *******" "https://gitlab.example.com/api/v4/groups/*****/projects?pagination=keyset&per_page=2000&include_subgroups=yes&order_by=id" | jq .[].id > project_id.txt while read i; do curl -XPOST --header "PRIVATE-TOKEN: *********" "https://gitlab.example.com/api/v4/projects/${i}/export" | jq done < project_id.txt with tweak in curl with same script I check status of export. I have problem with download – Aman35 May 18 '22 at 21:00
  • When I try to use same logic to download exports then loop does not wait for curl command to finish and corrupts the downloads. Any suggestions for this ? – Aman35 May 18 '22 at 21:04
  • Could you update your original post with your code? It is unformatted when in the comments section and difficult to follow. – Richard May 24 '22 at 21:34