Can azurepipelines-coverage.yml be used for repos hosted in GitHub? - 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).

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

'Centralized' wiki and repo in azure devops?

Living years in confluence+centralized git (bitbucket+github), recently coming to a small shop on MS azure devops, where the repo and wikis scattered between hundred of projects which impossible to find. Would it be a way to structure the azuredevops to make it more 'confluence' like?
Thanks
Would it be a way to structure the azuredevops to make it more 'confluence' like?
I am afraid there is no such a way to structure the azuredevops to make it more 'confluence'.
As we know, the Azure devops is a project-oriented product. Both the repo and the Wiki are based on one project. We can include multiple repo and wiki in a project, but cannot create a repo or wiki for multiple projects.
The workaround is that we could clone Wiki to the target project and Publish the code as wiki, you could check following thread for some more details:
Azure DevOps Wiki for multiple projects

Azure DevOps Repos synchronization between Organization

We have two Azure DevOps Organizations,
1. Development
2. Client
I would like to know if we can synchronize Azure DevOps Repos from one organization (Development) to different organization (Client) in a secure way?
If it is possible, what would be the best way to sync from one organization to another securely?
NOTE: We are able to manually clone the Repo from one to another organization for the first time with the help of PAT and GIT Auth but the problem arises when we want to update or re-sync the code. We have to manually re-import the repo (By deleting the existing one) to make changes.
We need to do this programmatically and to another organization.
Azure DevOps Repos synchronization between Organization
Sorry but as I know there's no such out-of-box feature available in Azure Devops Service.
There're similar user voices here: Sync between projects in same org and Automatically Sync Azure Devops Repos with GitHub Repos. Usually one organization is responsible for one product, so Azure Devops doesn't recommend cross-organization actions. But if you do want this behavior in your scenario, you can use these two directions:
1.Try free Git Tools for Azure Devops extension from Martin Hinshelwood. Some steps about how to use it:
Install it in your Development organization, it contains one Publish Git Repo task.
Create a new classic build pipeline named SyncRepos, add the Publish Git Repo task in it.
(Yaml pipeline also works well, but since this is one pipeline in which only exists one task, classic pipeline is enough)
Configure the task. We only need to configure the git repo url, so it's quite easy.
Assuming the name of same repos in another organization Client is ReposToSync, and this repos is in ProjectA. So the url you should enter in pipeline(in organization Development) should be:
See this: https://anything:PAT#dev.azure.com/Client/ProjectA/_git/ReposToSync.
(You should use a PAT which has repos-related permissions. I used Full Access one to test it easily but it should be much better if you create a PAT scoped in repos permissions. It's more secure !)
Now set the trigger, enable the CI and add all the branches into filter.
Yaml pipeline is better in step4 cause it supports trigger all branches with wildcard *. See this.
Now in Development organization, when I have any change in master and qwe branches, it will automatically trigger the pipeline to run. Then the task will sync the changes in Development's repos with repos in 'Client' organization.
Any change in Development org will start a sync, if you want to same behavior in 'Client', you also need another similar pipeline in 'Client'. And, yaml pipeline with wildcard is better if you want the pipeline to monitor newly created branch.
In additions: Apart from using the task from extension, we can also use git commands in CMD task if you're familiar with those commands.
2.Feel free to post a new feature request to our User Voice forum. If you gets enough votes, the request's priority increases and the team would consider it seriously.
Hope all above helps :)
Update1:
No matter git commands or extension, if we want to make it more secure(avoid using PAT or other secrets directly in task), we can use secrets to store the important info like PAT.
1.See create secret variable in Variable Group, then link the variable group, after that we can use $(MyPat) in task and it won't be displayed in log.
2.Also you can consider using Azure Key Valut. Related doc: Link secrets from an Azure key vault.
Today I tried a way of doing it I found in a blog post and it worked perfectly (and is tremendously easy to do).
Steps:
Create a PAT (personal access token) to your Development organization (I see you already have one so skip this step)
Go to the target repo in the Development organization, click clone and copy the url
In the Client organization import the repository with the url you have copied and with your PAT (same here, I think you already did this so skip this step)
Now clone the repo to your computer from the Client organization and add a remote to the repo in your Development organization. If you don't know about remotes, this page could help: Managing remote repositories
After this, you will be able to push and fetch from the Development organization's repo.
Source: Azure DevOps Fork Repos between two Organization - Michael Ghebremedin

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.

VSTS-GITHUB Workflow

Please elaborate the steps to create a workflow of Visual
Studio Team Services and Github.
Integration of Github with VSTS and creating a workflow.
Once we create user stories in vsts, is there any way to create a
transition from one state to another(New->Active->resolved),
based on repository update(github).
There is a way to transition from on state to another when github repo is update:
Create a CI build definition for the github repo.
Add a power shell task to change the stories state.
But usually user stories are linked with repo on VSTS not github, that’s more useful and meaningful.
Automatically is only using VSTS git repo.
If you like update this, you need to create a manual integration, possible using the VSTS Rest Api.