Skip to content

Migration of repositories from Gitlab to Azure DevOps

License

Notifications You must be signed in to change notification settings

drmaxgit/drmax-gitlab-azdo-migration

Repository files navigation

Dr. Max Gitlab AzDO Migration

Migrates gitlab repositories with open merge requests from Gitlab to Azure DevOps

Development

  • $ make dep initiates go modules
  • $ make test checks the code

Important Dependencies

Run!

  • $ make prepares win/linux/mac binaries into bin folder
  • Use your preffered binary with following arguments

Run Options

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

Service endpoint configuration

If you're importing private repositories you need to configure Service Endpoint in AzDO project to authenticate.

  1. In your Azure DevOps project navigate to settings
  2. In the left menu click Pipelines > Service connections
  3. Click New service connection
  4. Select Generic
  5. Fill following configuration
    1. Server URL https://gitlab.com
    2. Username gitlab.com
    3. Password/Token Key YOUR GITLAB API TOKEN
    4. Service connection name AzDO migration (or any other descriptive text)
  6. Click Save
  7. 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**
  8. You can remove the service endpoint once you're done importing your repositories.

Config File

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

Known issues

  • 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.

About

Migration of repositories from Gitlab to Azure DevOps

Resources

License

Stars

Watchers

Forks

Packages

No packages published