Migrates gitlab repositories with open merge requests from Gitlab to Azure DevOps
$ make dep
initiates go modules$ make test
checks the code
- https://github.com/xanzy/go-gitlab used for Gitlab communication
- https://github.com/microsoft/azure-devops-go-api used for AzDO communication
- https://gopkg.in/alecthomas/kingpin.v2 for cli input processing
$ make
prepares win/linux/mac binaries into bin folder- Use your preffered binary with following arguments
Name | Type | Description |
---|---|---|
--gitlab-token |
string (required) | Gitlab API token withapi, write_repository scope. Create access token here |
--azdo-org |
string (required) | Azure DevOps organization URLhttps://dev.azure.com/MYORG |
--azdo-token |
string (required) | Azure DevOps Personal Access Token withCode - Read, write, & manage scope. Create one at https://dev.azure.com/MYORG/_usersSettings/tokens |
--azdo-endpoint |
string (optional) | Azure DevOps service endpoint for gitlab. If you're importing private repositories you need to setup service endpoint for gitlab authentication. See below for details |
--config |
string (optional) | Project configuration file - see projects.example.json or below |
--recreate-repo |
bool (optional) | If added, script will first try to delete repository in AzDO before it creates a new one.Use with caution as the action is irreversible |
If you're importing private repositories you need to configure Service Endpoint in AzDO project to authenticate.
- In your Azure DevOps project navigate to settings
- In the left menu click Pipelines > Service connections
- Click New service connection
- Select Generic
- Fill following configuration
- Server URL
https://gitlab.com
- Username
gitlab.com
- Password/Token Key
YOUR GITLAB API TOKEN
- Service connection name
AzDO migration
(or any other descriptive text)
- Server URL
- Click Save
- Click on your service endpoint and your identificator will be visible in the URL
https://dev.azure.com/MYORG/MYPROJECT/_settings/adminservices?resourceId=**SERVICE_ENDPOINT**
- You can remove the service endpoint once you're done importing your repositories.
The structure of config file is as follows:
{
"projects": [
{
"gitlabID": 622148,
"azdoProject": "my-project",
"migrateMRs": true
},
#...
]
}
For each project you must (i.e. they're required) to specify three attributes:
- gitlabID - (int) ID of your gitlab project
- azdoProject - (string) name of the project where repository should be migrated to
- migrateMRs - (bool) whether or not active Merge requests should be migrated as well
- Empty repositories - repositories with no branches are not transferred due to limitation on Azure DevOps import request procedure
- Author of Pull request/discussion - It's nearly impossible to transfer author between the services thus:
- All pull requests are created under the user to which azure access token belongs to - we suggest creating specific user for the migration
- All pull request discussions are also authored to the access token user
- However for every item (both pull requests and discussions/comments) first line contains info on the original author as well as reference to their gitlab account
- Azure DevOps import notifications - for every import request azure will send you notification of successful import. If you're migrating huge amount of repositories, brace yourselves/your inboxes
- Existing disabled repository - it's not possible to fetch/remove existing disabled repository via Azure DevOps api.