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

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

Related

Can azurepipelines-coverage.yml be used for repos hosted in GitHub?

My company has few repositories hosted in GitHub with some .NET stuff, but uses ADO Pipelines for the CI/CD. Is it possible to use azurepipelines-coverage.yml (link to Microsoft documentation on it) to check pull request's code coverage? Or is that feature for ADO repositories only?
Would really appreciate any help!
I've added azurepipelines-coverage.yml to root folder along with main pipeline (new simple repo with simple code, few tests and repo), however, not sure how to "use" it, as there's no option to add it to PR check (similarly to ADO repos branch security).

Run gitlab-ci for another project

We have a application which is managed by third-party. They use Github to store source code. My company now use Gitlab for internal project. We setup Gitlab mirror to pull source code (incl branch: dev, stagging, master) from Github. It's working well now.
Now my manager want to setup Gitlab pipeline for automation process: build, test, deploy...I do it by commit .gitlab-ci.yml file to branch. But it's not good. After Gitlab pull code from Gitlab, it will overwrite my gitlab-ci file and remove it. So I must find another solution
Below is my idea now:
Create seperate project. It only contains gitlab-ci file
Detect changes on any branch in mirror repo
Trigger pipeline
Anyone has other idea for this case, please help me
P/S: third-party don't agree to add my gitlab-ci file into their repo in Github.

GitHub checks change the repo it builds on in Azure DevOps

Apparently someone was using another repo in Azure DevOps to build a repo in GitHub.
He no longer works here and I have to change this. I do a Pull Request and it builds on another repo. But it does build in the correct repo once I merge the code to master.
The reason I need to change it is that it looks like its building from a YAML that is old and not sure which one.
How do I change where GitHub checks build for a PR? Is it only by removing the build in that other repo?
You could find required Azure DevOps pipeline in GitHub - Repo -Settings - Branches-Branches protection rule - Require status checks to pass before merging
According to the pipeline name, you could find corresponding YAML file in Azure DevOps Project - Repo. Check if this pipeline locates at the wrong repo of Azure DevOps side.
You could directly change the right pipelines if they are listed in GitHub side. Otherwise, you may have to reconfigure GitHub-Azure DevOps Service connection through Azure Pipeline extension.

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.

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

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.