Is it possible to automate syncing of an external git repo to a AzureDevOps hosted internal git repo? - azure-devops

I would like to have a AzureDevOps internal git repository that is a forked version of an external open source library. Is it possible for AzureDevOps to have some way of automatically syncing with the external repo everyday?
I guess if it's not possible, I can have a script that automatically pulls from external and pushes to internal repo everyday.

If this is hosted on Github you can fork it and then trigger Azure DevOps pipeline on this fork change.

Related

How to copy files from one git repo to another git repo in Azure pipelines task?

There is one public source repo in github where all the source code is present. There is another github repo of mine which has some configuration files.
I want to run some tests of source repo using the configuration file present in my github repo using Azure pipeline task.
How can I checkout to source repo of github first and then do initial setup like build in that repo? And after that copy configuration files from my another github repo to the source repo directory and run tests of source repo.
I want to do these steps in Azure yaml pipelines as from azure release pipelines not all the artifacts are accessible.
Checking out multiple repos is possible, also with GitHub as a source, but don't forget to setup a GitHub service connection.
More info and options about this see: https://learn.microsoft.com/en-us/azure/devops/pipelines/repos/multi-repo-checkout?view=azure-devops#specify-multiple-repositories
Since you want the GitHub repo to trigger the Azure DevOps pipeline, please check out the feature that is available since October 2022:
https://learn.microsoft.com/en-us/azure/devops/pipelines/ecosystems/github-actions?view=azure-devops

Is there any way to maintain a remote connection when forking from Github to Azure DevOps?

I have used Azure DevOps 'Import Repository' to clone a repo from GitHub so that I can maintain a personal copy. I don't see any way to maintain the remote connection to GitHub so that I can merge in upstream changes.
Does Azure DevOps have such functionality or will I need to do this merging manually/locally?
No there is no way to treat Azure DevOps as a fork for GitHub. You need to manually perform merges and push/pull to and from both GitHub and Azure DevOps.
Not sure why you'd want to use Azure DevOps for your personal clone. As an alternative you can use GitHub for source code repository and link Azure Boards to GitHub and use Azure Pipelines to build, if those are your primary reason to use Azure DevOps.

Migrating from Bitbucket Server to Azure DevOps

While importing from Bitbucket Server which is accessible over VPN to Azure DevOps, I am facing the issue as "Clone URL is incorrect. Clone URL requires authorization". May I know how to fix this issue.
And I saw import repository option in Azure DevOps. But is there any way to import multiple projects and their repositories of Bitbucket Server to Azure DevOps?
Here is a suggestion ticket about add support for Bitbucket Server for Azure DevOps. You can vote this ticket.
As a workaround, you can use git commands to clone and push your repositories.
1.Clone the source repo to a temporary folder on your computer using the bare option.
git clone --bare https://github.com/contoso/old-contoso-repo.git
cd old-contoso-repo.git
2.Create a target repo.
3.Copy the source repo to the target repo.
git push --mirror https://dev.azure.com/contoso-ltd/MyFirstProject/_git/new-contoso-repo
Please find more detailed information in this document.
In Azure DevOps Import will happen from source repository URL's which are reachable from Azure DevOps Services which are basically running on cloud and require HTTPS reachability.
If BitBucket Server is hosting Repository on Private Network , it will not be reachable from Azure DevOps and hence we need the method provided by Walter above.

Publish a build artifect to a remote Git Repo - Azure DevOps

I have a build pipeline and I would like to publish the build artifect to a remote location which is a folder in an external Git repo. I have been able to create a "Azure Repos/Team Foundation" Server service connection to point to the external Azure DevOps. how do I consume that service connection through my build pipeline tasks? I could also use a release pipeline and copy the package over to a remote Git repo as well. How can I achieve this ?
I found the solution for this by using this extension - you can use it to point to a
TFVC repo
Git repo
Build pipeline
Release pipeline
TFS Artifects for Release Management

Transfering the data from TFS to GitHUb

Our client is using TFS, and we are using GitHub
I would like to sync the projects from TFS to Github and from GItHub to TFS as batch process whenever the changes are made in either of them.
Can someone suggest easiest way of doing the same?
Thanks in advance
git-tfs which is a two-way bridge between TFS (Team Foundation Server) and git. However if you are using TFS2013 and later, you could use Git as the source control option. You could directly use normal git command such as git pull, git push.
For the command to the get from github, just use the normal git command such as: git-scm.com/docs/git-pull –
In Azure Devops or Github, both of them use git as their Version Control, so you can have both as separate git remotes.
You could just use some git commands to handle this. Which command please take a look at this blog.
For automated process, then you could use one CI build definition to achieve it. Detail steps as below:
Create a CI build with a PowerShell or cmd Task;
Select the VSTS git repo in Get sources step;
Enable continuous integration andspecify include all branches for
Branch filters:
Two samples for your reference:
How to synchronize VSTS and Github respositories when commits are made
Syncing my Github repo to MS Visual Studio Team Services
Besides, you could also use some 3-rd party extension to handle this, such as this one--Git Tools for Azure DevOps
Azure Pipelines Build and Release extension that helps you synchronise one Git Repository with another.
You can use this extension with any Git repository: TFS, GitHub, Azure DevOps, Git, etc.