Migrating from Gitolite with Redmine to Gitlab

Recently, SDSLabs, the campus tech group of IITR I am a member of, migrated from Gitolite with Redmine to Gitlab. I found the materials available on this matter is very less and mostly we had to invent our own wheel to move our repositories, issues, wikis and users to Gitlab. So I thought of writing a blog post, in case any one in future may need these steps and so that he may not have to reinvent the wheel.

Note: To follow the guide you need to first have an administrator account(i.e. its active browser cookie and private token) in Gitlab and need an Redmine administrator account key for Redmine REST API.

Important: All the scripts given are dependent on the base.py and the conf.py file of the original repo: https://github.com/sdslabs/redmine-to-gitlab. So to use it, clone the repo or tweak the script to be independent of them.

First comes the transfer of the repositories.

Well this is the easiest part of the story! There is an official guide for this and a rake task. All you  have to do is copy the base repos from your gitolite repository directory to gitlab's and run the rake task. That's it.
Although, there is some concern about the namespace, but this is up to you. Gitlab lacks global namespace and they are never going to bring this back. We overcame this by creating a group with our organisation name and banning personal namespace (which required a few source code tweaks, we have removed the option of using the personal namespace and laid out restriction in source code).

Here another concern are the wiki repos of Redmine, which had fair amount of useful information about the organisation but no bare repos.
What I did was, I created the projects though a script here: projects not in Gitlab script
Then, during the wiki transfer the rest of the job was done!

Then comes the transfer of users.

I didn't expect a official guide for this.
Here for our rescue, we have a pretty nice API endpoint for our need, but the problem is that we had to specify the password for the user also, which we definitely didn't like. We wanted something like the browser endpoint, where I only need to specify the name, username and mail address and the rest of my job is done. So the option was pretty simple, manually enter the details of all the users. Well, then whats the fun in this? So, what? Write a script!
I inspected the data that the browser was sending on each user creation and made that into a script: user import script
This script requires an browser cookie of an administrator account, which is fairly easy to obtain, and an Redmine admin account key, which you must posses.
Here is the script for users transfer.

After that the wikis!

For wikis, strangely, they didn't provide any API endpoint. So again I had to take the browser way and write the script for it.
Here is the script: wiki import script
This script also requires an browser cookie of an administrator account and an Redmine admin account key.

Finally came the issues which really created an issue for us! 

Here I had an API end point for creation but what I wanted and they didn't provide is to specify the date of creation.
With another script: issue transfer script (this script require the private token of an admin to be set in the conf file) we transferred the issues and preserved the order, but we failed in transferring the other data associated with it. 


So, I hope that this may light the way of some other who wish to migrate from Redmine to Gitlab!

Comments

  1. Hi,

    thank you for your post.

    We're using gitolite+redmine too, and are thinking of migrating to gitlab.

    One year later, what do you think of the transition ?
    Is gitlab good ?
    Are you missing some features from redmine ?

    ReplyDelete

Post a Comment

Popular posts from this blog

Gmail SMS Notification For New Mails(new, easy and simplified meathod)

Hospital Management System (my second full fledged program)

Beginner's Guide to install Kali Linux in UEFI system (Lenovo Z510)