Share via

PublishCodeCoverageResults@2 duplicated artifacts

Pawlowska Malgorzata 80 Reputation points
2025-11-04T14:10:05.3566667+00:00

Hi. I started using PublishCodeCoverageResults@2 in my pipeline and it seems to publish duplicated artifacts. I am using pytest and pytest-cov.
In artifacts I see (indexes & coverages seems to be duplicated):
Code Coverage Report_<build_id>:
._py.html
index.htm
index.html
Summary_4ecf013f: coverage.xml
Summary_ffd3a4e0: coverage.xml

What strings after Summary_ means? Are they randomly generated or correspond to sth?

Below is the task configuration in pipeline:

- task: PublishCodeCoverageResults@2
  condition: always()
  inputs:
    summaryFileLocation: 'reports/coverage.xml'
  displayName: "Publish code coverage results"
Azure DevOps

Answer accepted by question author

Pashikanti Kumar 1,725 Reputation points Microsoft External Staff Moderator
2025-11-04T20:15:43.0933333+00:00

Hi Pawlowska Malgorzata,

The duplicated artifacts observed when using PublishCodeCoverageResults@2 in your pipeline with pytest and pytest-cov are due to how the task internally generates unique coverage summary reports. The suffix strings after "Summary_" are unique identifiers (usually hashes) representing different report versions or metadata generated during the pipeline execution.

  • The duplicated artifacts like Summary_4ecf013f: coverage.xml and Summary_ffd3a4e0: coverage.xml result because PublishCodeCoverageResults@2 internally processes multiple coverage report snapshots or segments, assigning unique identifiers.
  • There is currently no option in the PublishCodeCoverageResults@2 task to disable this duplication or the internal report generation mechanism.
  • This behavior is known and documented in community reports and GitHub issues, and Microsoft is aware but has not provided a built-in configuration to suppress duplication yet.
  • Until a future update, you can either accept these duplicates or revert to using PublishCodeCoverageResults@1 combined with a separate report generation step for more control.
  • Ensure your pytest.ini or coverage config files are not generating multiple coverage files inadvertently.
  • Monitor Microsoft Docs and GitHub for updates or fixes to this behavior.

 

References:

PublishCodeCoverageResults@2 - Publish code coverage results v2 task | Microsoft Learn

[REGRESSION]: PublishCodeCoverageResults@2 no longer uploads the artifacts to the pipeline · Issue #19547 · microsoft/azure-pipelines-tasks

I hope the provided answer is helpful,

Please "Up Vote" if the information helped you. This will help us and others in the community as well.

Thank you.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.