0

My current organization is having an requirement to migrate source code + history linkages from vendor TFS 2015 which is at remote site to our Azure Devops(Repos). The challenge I am having is that since source TFS is in remote site and not connected by our AD, could not find a way to link it. Currently we are using explict logins to their tfs and getting the code. Is there any possible way to migrate the same and do the synching daily, for few months and unplug the dependency on remote.

Any help would be much appreciated..

Renji
  • 391
  • 2
  • 7
  • 20

1 Answers1

1

Not sure the Azure DevOps(Repos) you mentioned are Azure DevOps Service (prior VSTS) or Azure DevOps Server 2019(prior TFS) In your case, seems you just want to perform a source code synchronization between TFS2015 to Azure DevOps service or Azure DevOps server.

For Azure DevOps Service : When you decide to make the move from Azure DevOps Server to Azure DevOps Services, there are many approaches to doing this which vary in both the fidelity of the data transfer and the complexity of the process.

  • Option 1: Copy the most important assets manually
  • Option 2: High fidelity database migration
  • Option 3: Using public API-based tools for higher fidelity migration

Only the option2 will include source control history during the migration. But it also have some limitation, such as import tool supported version. Currently only the following versions of Azure DevOps Server are supported for import: Azure DevOps Server 2019 and Azure DevOps Server 2019.0.1

In your scenario, you could use a CI build in TFS2015 to sync the Azure DevOps repo automatically. And the biggest challenge here is the authentication for both TFS and Azure DevOps Service. Just as you mentioned using explicit logins and powershell script should do the work.

A sample for your reference:

1. Create a CI build in TFS 2015

In your TFS 2015 project where the git repo hosted -> create a build definition with the TFS 2015 git repo as repository -> enable CI with all branches included.

enter image description here

2. Add a PowerShell task to sync TFS2015 git repo to Azure DevOps Service Add a PowerShell task in the build definition with below script:

if ( $(git remote) -contains 'vsts' )
{
    git remote rm vsts 2>&1|Write-Host
    echo 'VSTS Account removed'
}


git remote add vsts https://Personal%20Access%20Token:{PAT}@{account}.visualstudio.com/{project}/_git/{repo}

git checkout ${env:BUILD_SOURCEBRANCHNAME} 2>&1|Write-Host
git reset --hard origin/master 2>&1|Write-Host
echo 'update local branch with remote successfully'
git push  vsts ${env:BUILD_SOURCEBRANCHNAME} -f 2>&1|Write-Host

Note: the vsts remote should be added with credential. And it uses PAT for authentication in the Azure DevOps Service git repo URL. And you just need to replace the real PAT, accountname, projectname and reponame in the URL https://Personal%20Access%20Token:{PAT}@marinaliu.visualstudio.com/{project}/_git/{repo}.

Save the build definition, and now when any branches are updated in TFS 2015 git repo, VSTS git repo will be synced automatically for the corresponding branches.

Community
  • 1
  • 1
PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • Thanks Patrick for the input. Sorry, its Azure Devops Service and we are on private cloud. The challenge is that we cannot have a mutual trusted connection due to security reason. So right now i am thinking of pulling the source code from remote site using explicit logins to on premise build server and pushing the downloaded code to Azure repos, both using Azure pipelines. Its kinda indirect and not efficient though, and require more powershell scripting – Renji Aug 27 '19 at 13:50
  • Renji,Sorry for the misunderstanding. Have updated my reply. In your case, you could use a CI build in TFS2015 to sync the Azure DevOps repo automatically. But this operation will not keep any history in TFS. And the biggest challenge here is the authentication for both TFS and Azure DevOps Service. Just as you mentioned using explicit logins and powershell script should do the work. – PatrickLu-MSFT Aug 28 '19 at 01:49
  • Thanks Patrick. Unfortunately remote Vendor tfs source is in TFVC not git. Is there any way to have one to one mapping in the same vc format. – Renji Aug 29 '19 at 07:27
  • @Renji Unfortunately this functionality isn't available on TFVC, but recent versions of TFS can import your main branch with history into Git in a quick one-time process. From there it's not a lot of work (relatively) to make the technical switch. A trick would be to import your main branch into Git on the TFS end and then use the mirror guidance to clone your repo to VSTS without having to import the onprem server into VSTS. Take a look at this similar question here: https://stackoverflow.com/questions/48116442/code-branched-shared-on-vsts-and-local-tfs – PatrickLu-MSFT Aug 29 '19 at 08:43
  • @Renji For TFS 2015 you could use some 3rd-party bridge such as git-tfs. If you do not want to covert to GIT and keep work in TFVC. You may have use client API to create work space and download changes from TFS. Copy and create a new workspace then establish mapping with remote VSTS. Check in pending changes. It's a little complicated but also able to do this and well documented in some blogs through google. – PatrickLu-MSFT Aug 29 '19 at 08:48
  • Thanks a lot for the input Patrick. Will try this solution out. – Renji Aug 30 '19 at 03:00