How to get code coverage badge for azure pipelines - azure

I have my github project configured for automated builds in Azure Pipelines. Under "Pipelines/Builds/" I can click on "..." and select "Status badge".
Inside pipelines, code coverage is already measured: I can select a specific build, and go to the tab "Code coverage". However, I can't find any link to the coverage badge. Is it provided by Azure Devops? Or is there any free tool that integrates with Azure Devops to provide this?

You can get a coverage badge for Azure Pipelines by using shields.io:
go to https://shields.io/category/coverage
select Azure Devops coverage
As the website instructs, you need to find out organization,
project and definition id. Head to the Azure pipelines, and open
the view where you can see the history of builds for your project. The URL will contain all 3 values, e.g. dev.azure.com/ikamenshchikov/flynt/_build?definitionId=1
enter the values you have found in Azure into shields.io blank
fields, and click Copy Badge URL to get an URL to the image. You will get an URL like e.g. https://img.shields.io/azure-devops/coverage/ikamenshchikov/flynt/1.
now you can use this url to add the shield to e.g. your github
README.md. Add the text
![Coverage](https://img.shields.io/azure-devops/coverage/ikamenshchikov/flynt/1)

Related

Allure report with build number Azure Devops

I am created Web App in Azure Portal. And set up Allure report plugin to Azure Devops. Everything work fine, but when I start new pipeline with test, the old test information in the portal is removed and the new one is added. It turns out that in the end I can not view the old information about the tests when I want. I tried to configure the Allure report step so that the folder that will be created has its own $(Build.BuildNumber), but if it is uploaded via FTP to the portal, the portal becomes inaccessible because a folder with a report appears in the path /site/wwwroot and the portal does not reproduce it.
How do I need to set up my web app or steps in azure devops so that I can save and view reports, both old and new?
The Allure Generate Build Step will only generate the Allure report and save it as a build artifact. Then, using Azure File Copy task to copy the repots to Microsoft Azure storage blobs may help you to collect all the reports. Then, you could access the blob with all the reports as you want.

Is it possible to disable manual publishing of Azure Functions?

We have an Azure Function and an Azure DevOps Pipeline, the pipeline builds and published the code of the function's repo automatically. We want to escape discrepancies caused by, potentially, people manually publishing a version of the code, from within their Visual Studio, that is not in source control.
How can we ensure that?
Is there a way to disable manual publishing and only allow the Azure DevOps Pipeline to publish code to the function?
I am referring to a person using the "Publish" option in Visual Studio. Is there a way to forbid the Azure function from accepting such a publish?
To stop manual changes to the build, yaml files and pipeline would be to restric access to the build section of the pipeline for all the users.
This way no one will be able to change the pipeline but the admin user will still have access to the pipeline.
To set the permission we have to go to manage security which is under the pipeline tag.
Then we can select the permission for the users.
Here each tag represents a permission. Since we want to stop manual deployment we would set Edit build pipeline and Edit quality pipeline to deny.
These permissions can be set for individuals as well as security group.
Reference:
permissions in devops.

build and deploy two project in one azure web app using azure devops

I have two projects (Web & Web API) in dotnet core under one solution. I am able to deploy single though Azure devops and Azure web app. But i want to build both project in azure devops single pipeline and publish to single azure web app with different path mapping. i tried all the possible way to build and deploy both project under one pipeline to one azure web app. it's not working. need guidance.
Create multiple Projects in a single solution and save in a single repository.
Navigate to Pipelines, click New and then New build pipeline.
Click Use the classic editor.
By default, the first repository (Azure Repos Git) will be selected for you, just click Continue.
Select ASP.NET Core and then click Apply.
From here, we will make use of the Path Filters properties in the Triggers settings for the build.
With the proper path to the project in the Path filter only the proper Builds spin up, and any projects untouched do not trigger a build.
Each build has it's own release which then deploys the specified app to it's own destination.
Under Path filters, we need to specify the paths to look for file changes.
Check Enable continuous integration.
Under Branch Filters, click Add and add the master branch.
Under Path filters, we need to specify the paths to look for file changes, you want to include /SampleWebApp and /SampleWebApi.
Click Save & queue and then Save & queue.
Repeat for the SampleWebApi project.
Please refer Multiple Project Deployment with Azure DevOps and SO for more details.

End to End Traceability in Azure DevOps for any work item until deployment

in azure DevOps, if changes in the form of the work item are committed. That WI further builds and deployed... So can I get a tabular data as when it was build/rebuild and deployed in any of which environment and what is the current status of that WI?
You will be able to get this info as below:
While commiting the code changes you should associate the work item
After commiting the CI Build will trigger. Post that in that work item, there will be link reference to the Build
And when this build is deployed to any of the release environments, it will be displayed under. You can check this new feature introduced in Azure DevOps here
But if you want all this information in a table, in one single view. You have to use Azure DevOps REST APIs to build a customer report to get all the data in one place.

DevOPS with Azure Data Factory

I have created Azure Data Factory with Copy Activity using C# and Azure SDK.
How can deploy it using CI/CD ?
Any URL or link will help
Data Factory continuous integration and delivery is now possible with directly through the web user interface using ARM Templates or even Git (Github or Azure DevOps).
Just click on "Set up Code Repository" and follow the steps.
Check the following link for more information, including a video demostration: https://aka.ms/azfr/401/02
One idea that I got from Microsoft was that using the same Azure SDK you could deserialize the objects and save down the JSON files following the official directory structure into your local GitHub/Git working directory
In other words you would have to mimic what the UI Save All/Save button does from the portal.
Then using Git bash, you can just commit and push to your working branch (i.e. develop) and from the UI you can just publish (this will create an adf_publish release branch with the ARM objects)
Official reference for CI using VSTS and the UI Publish feature: https://learn.microsoft.com/en-us/azure/data-factory/continuous-integration-deployment
Unfortunately, CI/CD for ADF is not very intuitive at first glance.
Check out this blog post where I'm describing what/how/why step by step:
Deployment of Azure Data Factory with Azure DevOps
Let me know if you have any questions or concerns and finally - if that works for you.
Good luck!
My resources on how to enable CI/CD using Azure DevOps and Data Factory comes from the Microsoft site below:
Continuous integration and delivery (CI/CD) in Azure Data Factory
I am still new to DevOps and CI/CD, but I do know that other departments had this set up and it looks to be working for them.

Resources