January 26th, 2024
heart6 reactions

New version of Publish Code Coverage Results task

Bohdan Janousek
Senior Program Manager

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.

Author

Bohdan Janousek
Senior Program Manager

Bohdan has joined the Azure DevOps team in March 2022.

Single comment
  • Igor NajdenovskiMicrosoft employee

    Update: Based on user feedback, we have pushed an update to the PublishCodeCoverageResults@2 task to close the functional gaps that existed with the v1 task. The new update has been released to all customers, so you can already take advantage of its benefits.

    The v2 task now supports:
    - diff coverage.
    - the code coverage tab of the v2 task contains the same level of details as the one from the v1 task.
    - all kinds of coverage formats such as: .coverage, .covx, .covb, .cjson, .xml, .lcov, pycov, etc. It generates a cjson file which contains the code coverage details. It...

    Read more