We’ve introduced a new V2 version of the publish code coverage results task (known as PCCR) in Azure Pipelines recently. The main benefit of the V2 task is the support for more formats of the code coverage results and therefore more programming languages than the V1 task, which was limited to Cobertura and JaCoCo formats only. You can see more details for the V2 task in our public documentation.
The V2 task was made compatible with the build quality check task (known as BQC) in version 2.231.0. Any customer using build quality check can safely migrate from the V1 task to the V2 task version 2.231.0 or later.
While we don’t have any immediate plans for deprecating the V1 task, we will stop improving the V1 task and continue to address only critical issues. All our efforts to add new features will be directed towards the V2 task. Now we are adding support for two additional code coverage result formats (.coverage and .covx) to the V2 task. These new formats will be supported in version 2.233.0 that will be made available to anyone on Azure DevOps Service in February 2024. Therefore, we highly recommend our customers to stop using the V1 task and to migrate to the V2 task. Use of the V2 task will ensure you can use an extended list of file formats and programming languages and will be able to leverage new ones as they get added in the future.
The V2 task is available to anyone on Azure DevOps Service or Azure DevOps Server 2022 and later.
Phase I – User opt-in
Users of either Azure DevOps Service or Azure DevOps Server 2022 and later should migrate all their publish code coverage results V1 tasks to the V2 task. The V2 task provides additional features against the V1 task while maintaining all the features of the V1.
Users are encouraged to replace their V1 tasks with the V2 tasks.
Phase II – Warning
Late February 2024, we will start to warn users who are using, or will try to use, the publish code coverage results V1 task. Specifically, we’ll do the following:
- Add warning to the pipeline log file if that pipeline runs the publish code coverage results V1 task.
- Show a warning to pipeline authors when adding the publish code coverage results V1 task.
The warning in both cases will have the link to this blog post and will state:
“New V2 version of task publishing code coverage results is available to all our customers now. We highly recommend to stop using the V1 version and migrate to V2 version (https://learn.microsoft.com/azure/devops/pipelines/tasks/reference/publish-code-coverage-results-v2). For more details see https://devblogs.microsoft.com/devops/new-pccr-task.”
Q&A
Q: I’m using Azure DevOps Server version earlier than 2022. Does this apply to me too?
A: No, it does not. Nonetheless, when upgrading to Azure DevOps Server 2022 and later or migrating to Azure DevOps Service, you should consider using the more feature rich V2 version of the publish code coverage results task.
Q: I’m using Azure DevOps Server version 2022. What will happen to me?
A: In a future version of the Azure DevOps Server, we will also remove the V1 version of the publish code coverage results task. There will be a transitioning period where the V1 version will still run. During the transition period you’ll need to move from the V1 version to the V2 version, as when the transition period ends the V1 version will be removed and any pipeline containing that task will fail.
Q: What do I need to add to the YAML pipeline definition to use the V2 task?
A: For details on configuration see the documentation for the V2 task here ( https://learn.microsoft.com/azure/devops/pipelines/tasks/reference/publish-code-coverage-results-v2).
Q: Will there be any automatic conversion from V1 to V2 tasks done or will there be any script provided to handle the migration?
A: No, there will be neither automatic conversion of the pipelines to run V2 task instead of V1 nor any script provided to do such conversion.
Q: I’m using V1 task to publish the Code coverage reports created by Report generator, can I use that flow in V2 task?
A: No, the V2 task does not support publishing of the code coverage reports created by Report generator task anymore.
Q: I’m using the line view of the code coverage produced by the V1 task. Is that supported in V2 task too?
A: No, the V2 task does not provide the line view of code coverage for now. We’ll be adding that in the future version of V2 task.
You wrote “While we don’t have any immediate plans for deprecating the V1 task”, but the commit that introduced the annoying warning disagrees:
We highly recommend to stop using the V1 version and migrate to V2 version
As some of the other comments have outlined.
Please do not remove PublishCodeCoverageResults@1 until PublishCodeCoverageResults@2 allows us to publish our own ReportGenerator generated reports.
Yes, the current gap between V1 and V2 (missing line and branch based coverage) is because the V2 does not use the report generator internally. There were issues with report generator for larger repositories and...
We rely on the functionality to see coverered lines to see where we need to create more tests cases for our integration tests. We can’t upgrade to v2 until it has this functionality.
@Bohdan Janousek, what’s the plan for v3 or at least 2.1 which won’t require .NET Core 2.1 which saw its end of live in August 2021?
How come do you recommend migrating to something which has a hard but long-time deprecated version dependency like that?
The lack of branch coverage and lack of showing the covered lines in source code means this V2 task is essentially useless. V1 should not be marked deprecated until V2 has at least the same functionality. Staying on V1 for now, as V2 is pretty useless to me for the moment.
Completely agree, V2 seems to be totally useless and the V1 deprecation warnings are irritating.
+1. The new task is one step forward, two steps back.
Feels strange to note that the main concern of the “Publish Code Coverage Results” is not related to the publication of the code coverage results, but to secondary things such as “Build quality check” task. Why this drawback? The V1 version seems reasonable better by far
The documentation on https://learn.microsoft.com/en-us/azure/devops/pipelines/test/review-code-coverage-results?view=azure-devops seems outdated and has a lot of broken link.
Also you make it seem the upgrade is trivial while it's unclear how to set up with the new task version. I used to get the line coverage report while using:
<code>
The v1 task automatically ran ReportGenerator under the hood and would upload reports (which appeared on the code coverage tab) that not only showed line/branch coverage but also let you navigate through the files, see covered lines and more. (We don't run report generator manually, so it has to be done by Azure DevOps for us).
V2 does not do this. The report is very basic and lacks a ton of functionality which we relied on...
There does not seem to be any way of squelching the warning.
See here:
We do expect to close the gap between the V2 and V1. Mainly the line based coverage. The V2 task is not using the report generator and there are no plans to rely on that. Nonetheless there still may be benefit on the V2 task - code coverage for folders and there can be set build quality checks to ensure respective folders will meet the requirements that may differ from the overall coverage required.
this comment has been deleted.
My organisation uses the Build Quality Checks task based on branch coverage so branch coverage is what we are really interested in seeing on the report. Using version 1 of this build task combined with ReportGenerator task gave us a report that showed line coverage and branch coverage but with version 2 we now just have line coverage. Is there any plan to include branch coverage in the report or better yet add...
We do plan to look into supporting the branch based code coverage in the V2 task.
I tried upgrading to v2 today (2.236.1) in Azure DevOps but faced 2 issues - no results on the Code Coverage tab of the build pipeline page; and the code coverage report wasn't uploaded to the build's published artifacts. These are both despite the absence of any warnings or errors in the task's output logs. I see similar issues have been raised at https://github.com/microsoft/azure-pipelines-tasks/issues/18782 and https://github.com/microsoft/azure-pipelines-tasks/issues/19547.
So I'm reverting to v1 and will put up with...