Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PublishCodeCoverageResults Fails to Generate HTML Report #13914

Closed
trangevi opened this issue Nov 18, 2020 · 10 comments
Closed

PublishCodeCoverageResults Fails to Generate HTML Report #13914

trangevi opened this issue Nov 18, 2020 · 10 comments
Assignees
Labels
Area: ABTT Akvelon Build Tasks Team area of work Area: CodeCoverage Area: Test bug

Comments

@trangevi
Copy link

Required Information

Entering this information will route you directly to the right team and expedite traction.

Question, Bug, or Feature?
Type: Bug

Enter Task Name: PublishCodeCoverageResultsV1

list here (V# not needed):
https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/PublishCodeCoverageResultsV1

Environment

  • Server - Azure Pipelines or TFS on-premises?

    Azure Pipelines

  • Agent - Hosted or Private:

    Private Ubuntu 16.04

Issue Description

The PublishCodeCoverageResults task in our build has recently been unable to generate the HTML report, which I believe is what is causing us to be unable to view the CodeCoverage tab we are used to. It seems to be an issue with finding ReportGenerator, but I've included the task logs as I'm unclear what specifically to be looking for.

It seems like it could be introduced in the newest version of the task, as it was working on version 1.175.0, but is now failing on 1.175.2 (I don't have any runs on patch version 1). Nothing else has changed on our pipeline between the two, however it's possible some assumption of ours on how to use the task is no longer valid.

I've attached full debug logs for the failed run. Please let me know if I can provide any further information. Thanks in advance.

Task logs

PublishCodeCoverageResults_failed.zip

Error logs

/usr/bin/dotnet "/agent/_work/_tasks/PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97/1.175.2/netcoreapp2.0/ReportGenerator.dll" -reports:"/agent/_work/4/s/CodeCoverage/Cobertura.xml" -targetdir:"/agent/_work/_temp/cchtml" -reporttypes:HtmlInline_AzurePipelines
Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET Core program, but dotnet-"/agent/_work/_tasks/PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97/1.175.2/netcoreapp2.0/ReportGenerator.dll" does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
##[warning]Failed to generate Html report. Error: 1
@EzzhevNikita EzzhevNikita added the Area: ABTT Akvelon Build Tasks Team area of work label Nov 18, 2020
@egor-bryzgalov egor-bryzgalov self-assigned this Nov 18, 2020
@aressler38
Copy link

aressler38 commented Nov 19, 2020

This is happening to me too. I confirm it is also happening with the 1.175.2 version. I have a previous run on version 1.175.1 that worked, so something broke in 1.175.2.

2020-11-19T18:06:45.7947136Z ##[section]Starting: PublishCodeCoverageResults
2020-11-19T18:06:45.7960861Z ==============================================================================
2020-11-19T18:06:45.7961182Z Task         : Publish code coverage results
2020-11-19T18:06:45.7961460Z Description  : Publish Cobertura or JaCoCo code coverage results from a build
2020-11-19T18:06:45.7961731Z Version      : 1.175.2
2020-11-19T18:06:45.7961923Z Author       : Microsoft Corporation
2020-11-19T18:06:45.7962259Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/test/publish-code-coverage-results
2020-11-19T18:06:45.7962957Z ==============================================================================
2020-11-19T18:06:46.2875879Z [command]/usr/bin/dotnet "/home/vsts/work/_tasks/PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97/1.175.2/netcoreapp2.0/ReportGenerator.dll" -reports:"/home/vsts/work/1/s/coverage/cobertura-coverage.xml" -targetdir:"/home/vsts/work/_temp/cchtml" -reporttypes:HtmlInline_AzurePipelines
2020-11-19T18:06:46.3910421Z 
2020-11-19T18:06:46.3977683Z Welcome to .NET Core 3.1!
2020-11-19T18:06:46.3978839Z ---------------------
2020-11-19T18:06:46.3979176Z SDK Version: 3.1.404
2020-11-19T18:06:46.3979312Z 
2020-11-19T18:06:46.3979436Z Telemetry
2020-11-19T18:06:46.3979733Z ---------
2020-11-19T18:06:46.3980683Z The .NET Core tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.
2020-11-19T18:06:46.3981229Z 
2020-11-19T18:06:46.3981825Z Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry
2020-11-19T18:06:46.3982079Z 
2020-11-19T18:06:46.3982324Z ----------------
2020-11-19T18:06:46.3982686Z Explore documentation: https://aka.ms/dotnet-docs
2020-11-19T18:06:46.3983022Z Report issues and find source on GitHub: https://github.com/dotnet/core
2020-11-19T18:06:46.3983502Z Find out what's new: https://aka.ms/dotnet-whats-new
2020-11-19T18:06:46.3984010Z Learn about the installed HTTPS developer cert: https://aka.ms/aspnet-core-https
2020-11-19T18:06:46.3984586Z Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs
2020-11-19T18:06:46.3985111Z Write your first app: https://aka.ms/first-net-core-app
2020-11-19T18:06:46.3985612Z --------------------------------------------------------------------------------------
2020-11-19T18:06:46.5702865Z Could not execute because the specified command or file was not found.
2020-11-19T18:06:46.5703268Z Possible reasons for this include:
2020-11-19T18:06:46.5704049Z   * You misspelled a built-in dotnet command.
2020-11-19T18:06:46.5705187Z   * You intended to execute a .NET Core program, but dotnet-"/home/vsts/work/_tasks/PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97/1.175.2/netcoreapp2.0/ReportGenerator.dll" does not exist.
2020-11-19T18:06:46.5706019Z   * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
2020-11-19T18:06:46.5857030Z ##[warning]Failed to generate Html report. Error: 1
2020-11-19T18:06:46.5900205Z Reading code coverage summary from '/home/vsts/work/1/s/coverage/cobertura-coverage.xml'
2020-11-19T18:06:46.6990361Z ##[section]Async Command Start: Publish code coverage
2020-11-19T18:06:46.6990675Z Publishing coverage summary data to TFS server.
2020-11-19T18:06:46.6991076Z  Lines- 438 of 1231 covered.
2020-11-19T18:06:46.6991281Z  Branches- 162 of 654 covered.
2020-11-19T18:06:47.1937909Z Modifying Cobertura Index file
2020-11-19T18:06:47.1938306Z Publishing code coverage files to TFS server.
2020-11-19T18:06:47.1938485Z Uploading 1 files
2020-11-19T18:06:47.1938636Z File upload succeed.
2020-11-19T18:06:47.3472690Z Published '/tmp/Code Coverage Report_816' as artifact 'Code Coverage Report_816'
2020-11-19T18:06:47.3473077Z ##[section]Async Command End: Publish code coverage
2020-11-19T18:06:47.3474335Z ##[section]Finishing: PublishCodeCoverageResults

@MatthiasNistl
Copy link

MatthiasNistl commented Nov 19, 2020

Can confirm this issue with version 1.175.2. Earlier pipeline runs with version 1.175.0 worked fine, now I'm running into the same error messages:

2020-11-19T21:52:47.5443639Z ==============================================================================
2020-11-19T21:52:47.5443953Z Task         : Publish code coverage results
2020-11-19T21:52:47.5444274Z Description  : Publish Cobertura or JaCoCo code coverage results from a build
2020-11-19T21:52:47.5444537Z Version      : 1.175.2
2020-11-19T21:52:47.5444754Z Author       : Microsoft Corporation
2020-11-19T21:52:47.5445091Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/test/publish-code-coverage-results
2020-11-19T21:52:47.5445542Z ==============================================================================
2020-11-19T21:52:47.8987329Z [command]/usr/bin/dotnet "/home/vsts/work/_tasks/PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97/1.175.2/netcoreapp2.0/ReportGenerator.dll" -reports:"/home/vsts/work/1/s/**/coverage.cobertura.xml" -targetdir:"/home/vsts/work/_temp/cchtml" -reporttypes:HtmlInline_AzurePipelines
2020-11-19T21:52:48.0559911Z Could not execute because the specified command or file was not found.
2020-11-19T21:52:48.0560581Z Possible reasons for this include:
2020-11-19T21:52:48.0561422Z   * You misspelled a built-in dotnet command.
2020-11-19T21:52:48.0566307Z   * You intended to execute a .NET Core program, but dotnet-"/home/vsts/work/_tasks/PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97/1.175.2/netcoreapp2.0/ReportGenerator.dll" does not exist.
2020-11-19T21:52:48.0571109Z   * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
2020-11-19T21:52:48.0722853Z ##[warning]Failed to generate Html report. Error: 1

@adamconnelly
Copy link

adamconnelly commented Nov 20, 2020

I can confirm this as well. I've managed to work around the problem by explicitly pinning the task to an older version, like this:

I can also confirm that both 1.175.0 and 1.175.1 work correctly, but 1.175.2 doesn't. I think the reason that 1.175.2 doesn't work is because it added a change to add quotes around the path to the ReportGenerator.dll file.

Here's the PRs corresponding to those new version:

And here's the issue relating to the changes: #13062. It seems to have been trying to solve a problem where the task would fail if there were spaces in the path to the report generator dll by quoting the path. My guess is that the quoting is fine on Windows but causes issues on Linux.

This corresponds with what I can see from the build logs. Here's an example of the command run by 1.175.0:

/usr/bin/dotnet /home/vsts/work/_tasks/PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97/1.175.1/netcoreapp2.0/ReportGenerator.dll -reports:"/home/vsts/work/_temp/*/coverage.cobertura.xml" -targetdir:"/home/vsts/work/_temp/cchtml" -reporttypes:HtmlInline_AzurePipelines

And here's an example of the command run by 1.175.2:

/usr/bin/dotnet "/home/vsts/work/_tasks/PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97/1.175.2/netcoreapp2.0/ReportGenerator.dll" -reports:"/home/vsts/work/_temp/*/coverage.cobertura.xml" -targetdir:"/home/vsts/work/_temp/cchtml" -reporttypes:HtmlInline_AzurePipelines

I'll add a comment to the issue that this change was introduced for asking for it to be reverted until it can be fixed properly.

@ShreyasRmsft
Copy link
Member

ShreyasRmsft commented Nov 20, 2020

We will try and patch this immediately.

Please use the workaround of pinning it to the previous minor version immediately

@dkstringer
Copy link

I have observed the same bug. Most of my pipelines are using vmIImage: ubuntu-latest, and they all have the same error.

I have just seen a pipeline using vmImage: windows-latest work correctly with the exact same PublicCodeCoverageResults@1 (v1.175.2) task.
It successfully located the file D:\a_tasks\PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97\1.175.2\netcoreapp2.0\ReportGenerator.dll in the run log.

The failing ubuntu runs are trying to locate the file /home/vsts/work/_tasks/PublishCodeCoverageResults_2a7ebc54-c13e-490e-81a5-d7561ab7cd97/1.175.2/netcoreapp2.0/ReportGenerator.dll,

@egor-bryzgalov
Copy link
Member

@dkstringer @adamconnelly @knom @MatthiasNistl @aressler38 @trangevi
Hi everyone!

Thank you for the information you've provided!
The fix was applied. Could you please confirm that it works fine for you at the moment?
The fixed version is 1.178.0.
Thank you!

@aressler38
Copy link

Thanks @egor-bryzgalov. I can see it working now in 1.178.0.

@egor-bryzgalov
Copy link
Member

@aressler38
Thank you!
Closed this issue as resolved. Please feel free to reopen if you have any issues.

@trangevi
Copy link
Author

I confirmed it's working for me now as well. Thank you for the quick turn around!

@adamconnelly
Copy link

Me too - thanks for getting it sorted so quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: ABTT Akvelon Build Tasks Team area of work Area: CodeCoverage Area: Test bug
Projects
None yet
Development

No branches or pull requests

8 participants