Migrating remote repositories

Applies to Collaborator 14.0, last modified on September 26, 2022

Some remote repository hosting systems support migrating their repositories (including their pull requests) from one server instance to another. To continue using remote repository integrations after repository migration, you may either create a new integration pointing to the new repository URL, or migrate the existing integration to the new URL as described in this topic. When creating new remote repository integration, links from the existing reviews would remain unchanged and would lead to the previous location of the repository. When migrating existing integration, links from the existing reviews would be updated and will lead to the new location of the repository.

Migration procedure

To migrate an existing repository hosting integration, you need to call the AdminRemoteSystemService.migrateRemoteSystem command and then update the integration webhook using the AdminRemoteSystemService.updateWebhook command.

Call the following JSON API commands:

[
 {"command" : "SessionService.getLoginTicket",
         "args":{"login":"serveradmin","password":"somepassword"}},
 {"command" : "AdminRemoteSystemService.migrateRemoteSystem",
         "args":{
             "fromRepo": "https://bitbucket.org/TeamName/OldRepoName",
            "toRepo": "https://bitbucket.org/TeamName/NewRepoName"}},
 {"command" : "AdminRemoteSystemService.updateWebhook",
         "args":{"id":"<id>"}}
]

To learn the ID of the desired integration, you can list all available remote system integrations using the AdminRemoteSystemService.getIntegrations command:

[
 {"command" : "SessionService.getLoginTicket",
         "args":{"login":"serveradmin","password":"somepassword"}},
 {"command" : "AdminRemoteSystemService.getIntegrations", "args":{}}
]

How it works

The AdminRemoteSystemService.migrateRemoteSystem command performs the following actions:

  • Changes the title and repository URL in the respective integration configuration.
  • Restarts all remote system related services: caching system, GitLab group synchronization and so on.
  • Updates repository links in the Remote System Link section of all existing reviews.

Technical details and limitations

  • Migration is only possible within the same remote system. That is, for example, from GitLab to GitLab, or from Bitbucket to Bitbucket.
  • Migration is only possible for server instances of the same type. That is, from one cloud server to another cloud server, or from one on-prem server to another on-prem server.
  • Administrator privileges are required to run the AdminRemoteSystemService.migrateRemoteSystem command.
  • For audit purposes migration procedure does not update repository links in Chat and user comments sections.

See Also

Integration With Repository Hosting Services
Admin Tasks

Highlight search results