Azure-pipelines-tasks: Code coverage is showing as 0% in SonarQube when using the Jacoco option in the MavenV3 task.

Created on 4 Aug 2020  路  10Comments  路  Source: microsoft/azure-pipelines-tasks

Note

Issues in this repo are for tracking bugs, feature requests and questions for the tasks in this repo

For a list:
https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks

If you have an issue or request for the Azure Pipelines service, use developer community instead:

https://developercommunity.visualstudio.com/spaces/21/index.html )

Required Information

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

Bug
Type: Bug

Enter Task Name: MavenV3

MavenV3:
https://github.com/Microsoft/azure-pipelines-tasks/tree/master/Tasks

Environment

  • Server - Azure Pipelines or TFS on-premises? Azure Pipelines

    • If using Azure Pipelines, provide the account name, team project name, build definition name/build number:
      Org: MetLife-US
      Project Name: Dental
      Build Definition Name: DMA-PFR3-Release
      Build Number: 1.37441
  • Agent - Hosted or Private:

    • Private, RedHat 7 OS, Agent version - 2.165.0

Issue Description

It seems that the MavenV3 task was recently updated from version 3.171.0 to version 3.173.0. After the update we can see that the code coverage is showing as 0% in SonarQube when using the Jacoco code coverage option in the task within Azure DevOps. We can see in the commit history for the MavenV3 task that there were some updates for the code coverage report path and we are wondering if that is the source of the issue. If we switch to the Cobertura option the code coverage appears properly in Sonar.

Task logs

[Enable debug logging and please provide the zip file containing all the logs for a speedy resolution]

Troubleshooting

To Troubleshoot the issue we tried installing the newest SonarQube plugins, specifically SonarJava and Jacoco.

Error logs

There is no error in the logs, but the code coverage appears as 0%, where as previously it was approximately 50%.

ABTT Maven bug

All 10 comments

@tlbonds2 Do you still run into this issue?

Hello,
Yes we are still seeing the issue and we are wondering if the following commit caused the issue:
https://github.com/microsoft/azure-pipelines-tasks/commit/d176141b06c23aac345ff21c4d2fa74e3ef95956#diff-99ba5d31f4a9541e7aff1ae8d5e37cdf
When the MavenV3 task went from version v3.171.0 to 3.173.0, the Jacoco code coverage stopped being passed to Sonar and Sonar then reports 0% code coverage. If we switch to the Cobertura option there is no issue.

Thanks,
Tom

@tlbonds2 Could you please provide your logs?

@tlbonds2 As a workaround, could you please try to upload the patch from attachments using tfx-cli. To do that you may use these instructions. This patch reverts changes made in the "Maven and Gradle tasks fixes" commit.

Upload command example:

tfx build tasks upload -u https://<YOUR_ORGANISATION>.visualstudio.com/DefaultCollection -t <YOUR_PERSONAL_ACCESS_TOKEN> --task-path <PATH_TO_TASK>

Please, let us know if it works for you or if you have any questions.

Hi Ekaterina,
Sure I will try it and let you know. Thanks!
-Tom

@tlbonds2 This issue is not reproducible for me. It works correctly. Could you please provide your logs? Does the patch help to resolve the issue?

@ekaterina-tatanova
Sorry for the wait. Reverting the changes to the task did, in fact, resolve the issue. Let me know your thoughts on next steps.
Thanks,
Tom

Hi @tlbonds2 we are going to add ability to control this new behavior by input, and specify it as disabled by default - created PR with related fix

Thanks, @anatolybolshakov! I will look out for the release. Much appreciated.

Hi @tlbonds2 the fix for this issue has been rolled out - I'm closing it at the moment, please feel free to reopen it if this is still actual for you

Was this page helpful?
0 / 5 - 0 ratings