Migrate projects from Redmine to Gitlab
Migrate Redmine projects to Gitlab.
Enjoy.
#123
)(It was developed/tested around redmine 3.3, gitlab 8.2.0, python 3.4)
Many thanks to the @oasiswork team for the good work they have done with the project redmine-gitlab-migrator on which this project is based on.
You can or can not use virtualenvs, that’s up to you.
Install it:
pip install migrate-redmine-to-gitlab
(or if you cloned the git: python setup.py install
)
migrate-redmine-to-gitlab --help
This process is for each project, order matters.
For the example we will migrate project observe from Code Lutin Redmine to Ultreia.io Gitlab.
It does not need to be named the same, you just have to record it’s URL.
Add users to your project (we will se later how to map redmine users to them).
Note that if a redmine user can’t be found in gitlab, the issue/comment will be assigned to the gitlab admin user.
Import git repository.
Important note: The project must have NO milestone and NO issue.
Create a directory, go in it.
mkdir observe
cd observe
Create a config.json file with this content (adapt content with your credentials):
{
"redmine": { "host":"https://forge.codelutin.com", "path":"projects/observe", "key": "XXX" },
"gitlab": { "host":"https://gitlab.com", "path":"ultreia.io/ird-observe", "key": "XXX" }
}
Launch command
migrate-redmine-to-gitlab init
This will download all the redmine project stuff in directory redmine
You should have then a such directory layout:
observe
├── config.json
└── redmine
├── attachments
├── issues
├── project.json
├── users
└── versions
The directory redmine/users contains all users from the Redmine project.
To match a gitlab user, you need to set the login attribute in each file to the gitlab login.
Note that you won’t be able to continue migration process until all redmine users match any of one gitlab user.
migrate-redmine-to-gitlab roadmap --check
(remove --check
to perform it for real)
migrate-redmine-to-gitlab attachments --check
(remove --check
to perform it for real)
migrate-redmine-to-gitlab issues --check
(remove --check
to perform it for real)
migrate-redmine-to-gitlab issues-with-id --check
(remove --check
to perform it for real)
Note that your issue titles will be annotated with the original redmine issue ID, like -RM-1186-MR-logging. This annotation will be used (and removed) by the next step.
You can retain the issues ID from redmine, this cannot be done via REST API, thus it requires direct access to the gitlab machine.
So you have to log in the gitlab machine (eg. via SSH), and then issue the command with sufficient rights, from there:
migrate-redmine-to-gitlab iid --check
(remove --check
to perform it for real)
Will set the description of the redmine version with a link to the gitlab milestone.
migrate-redmine-to-gitlab link-roadmap --check
(remove --check
to perform it for real)
Will add a note to the redmine issue with a link to the gitlab milestone.
migrate-redmine-to-gitlab link-issues --check
(remove --check
to perform it for real)
An extra command I develop while testing issues imports. You should not use this command.
migrate-redmine-to-gitlab delete-issues