drmax-gitlab-azdo-migration

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2022 License: MIT Imports: 14 Imported by: 0

README

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.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL