Azure Devops SonarQubePublish: No analyses found in this build (with SonarQube 10.0)

  • SonarQube: Version 10.0 (build 68432)
  • Azure Devops SonarQubeAnalyze@5 (SonarScanner for MSBuild 5.12)
  • Azure Devops SonarQubePublish@5 (5.0.2)
  • Problem
    We recently upgraded from the LTS 9.8 build to 10.0, and then immediately started seeing problems in our azure devops pipeline where the Analyze step is fine:

INFO: ANALYSIS SUCCESSFUL, you can find the results at: http://xxx

But the publish step can’t find the analysis:

Starting: SonarQubePublish
==============================================================================
Task         : Publish Quality Gate Result
Description  : Publish SonarQube's Quality Gate result on the Azure DevOps build result, to be used after the actual analysis.
Version      : 5.0.2
Author       : sonarsource
Help         : Version: 5.0.2. [More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
==============================================================================
##[warning]No analyses found in this build! Please check your build configuration.

Hi,

Please share your full pipeline and analysis log.

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.

 
Ann

here you go Ann - let me know if I missed anything:
sonartest.txt (136.8 KB)

We are seeing the same message with SonarQube 10.0.0.

I guess this is the cause:
##[debug][SQ] API GET: ‘/api/server/version’ with query “undefined”
##[debug]Response: 200 Body: “10.0.0.68432”
##[debug]SonarQube version < 7.2.0 detected, falling back to default location(s) for report-task.txt file.

This is from the SonarQube task for Azure DevOps:
sonar-scanner-vsts/TaskReport.ts at 9adde0c364217e6b5ec57242a5e7ccef26ba7ddc · SonarSource/sonar-scanner-vsts · GitHub

We also notice SonarQube not returning the quality gate status check from Pull Requests when we don’t explicitly set the DevOps Platform Integration for each project separately (until now, we never needed to). Could this be the same reason, as the Azure DevOps tasks from SonarQube seem to think they are communicating with an older version of SonarQube?

Hi,

Thanks for the log. Can you upgrade to the latest version of the SonarScanner for .NET and see if this is still replicable?

@BMCP can yo create a new thread, please?

 
Ann

same issue with the latest upgraded versions (5.13.0):

Downloading task: CmdLine (2.212.0)
Downloading task: SonarQubePrepare (5.13.0)
Downloading task: UseDotNet (2.219.0)
Downloading task: DotNetCoreCLI (2.217.0)
Downloading task: CopyFiles (2.211.0)
Downloading task: SonarQubeAnalyze (5.13.0)
Downloading task: SonarQubePublish (5.0.2)
Downloading task: sonar-buildbreaker (8.1.2)

Hi,

Thanks. And can you share your pipeline as well?

 
Ann

sonarqube2_azuredevops.txt (137.2 KB)

Hi,

Thanks for the new log. What I’m asking for is your pipeline: the file that sets up what steps will run in which order.

 
Ann

ah sorry @ganncamp - here you go:
check-msbuild-steps.txt (2.2 KB)

Hi,

Thanks for the file. I’ve flagged this for more expert attention.

 
Ann

Hello - any update on this issue?

@ganncamp unless there isn’t any movement on this issue, we’re going to have to revert back to the v9.8 - any updates here since our pipelines depend on this service.

We are experiencing the same issue, the SonarPrepare step is identifying a version above 7.2.0 (we are on 10), but the SonarPublish step is identifying a version below 7.2.0.

We had clean runs on 4/7 and then on 4/10 they started erroring out - summary from our logs is below (still looking into if that was the weekend we went to version 10 or not):

SonarQubePrepare

  • Version 5.13.0
  • Logs out: SonarCloud or SonarQube version >= 7.2.0 detected, setting report-task.txt file to its newest location.

SonarQubeAnalyze

  • Version 5.13.0
  • Logs out the file report-task.txt location as: "sonar.scanner.metadataFilePath":"/opt/agent/_work/_temp/sonar/20230424.3/b17ced24-17c2-85b3-6abe-6f141199df2b/report-task.txt"

SonarQubePublish

  • Version: 5.0.2
  • Logs out: SonarQube version < 7.2.0 detected, falling back to default location(s) for report-task.txt file.

Then further in the logs I can see the adjusted report path doesn’t match what Analyze used prior.

##[debug]applying include pattern
##[debug]adjustedPattern: '/opt/agent/_work/26/**/report-task.txt'
##[debug]0 matches
##[debug]0 final results
##[debug][SQ] Searching for **/report-task.txt - found 0 file(s)
##[warning]No analyses found in this build! Please check your build configuration.

The getServerVersion API call to the sonar server is logging out as such:

##[debug][SQ] API GET: '/api/server/version' with query "undefined"
##[debug]Response: 200 Body: "10.0.0.68432"

Looking through the Sonar github code, I’m wondering if the non-semver “68432” after the patch version in the version string is making the logic fail. Specifically, in the prepare step this piece of code must not function the same as this piece that the publish code uses to check the version.

I know that we can probably do some manual file moves in the azure pipeline to copy the report file to the “old” directory, but I wouldn’t expect to have to do so.

A PR for this seems to be open :slight_smile:

Hopefully it gets merged soon.

2 Likes

Yes, a fix is underway, sorry for the inconvenience on this.

Mickaël

2 Likes

Will we need to update the SonarQube server 10.0.68432 on-premise?
What is the estimate date of availablity for this fix?

thx for the workaround btw @Alexander_Ameye , that helps us for now.

1 Like

This should all be fixed via an update to the Azure DevOps extension. If you’re still facing an issue, please don’t hesitate to let us know.

1 Like

Are you saying that we should expect a fix currently? The PR that was created is still Open and not merged, and our builds are still experiencing the error. Was this fixed in a different manner than the PR code change?