SonarQube links on Jenkins are not enabled for some jobs

We are using SonarQube 5.6.4 LTS together with Jenkins 2.89.4.

The SonarQube links on the Jenkins job home page work for some jobs, but not for a few others. For the jobs where they don’t work, they are just text, not actual links. The analysis seems fine. Here is an example:

[INFO] Analysis report generated in 96037ms, dir size=110 MB
[INFO] Analysis reports compressed in 212636ms, zip size=40 MB
[INFO] Analysis report uploaded in 4316ms
[INFO] ANALYSIS SUCCESSFUL, you can browse http://xxx.xxx.com:9090/sonar/dashboard/index/xxx.yyy.zzz:zzz-components:Trunk
[INFO] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
[INFO] More about the report processing at http://xxx.xxx.com:9090/sonar/api/ce/task?id=AWTySwRHqidIME-7mB8o

The link above http://xxx.xxx.com:9090/sonar/dashboard/index/xxx.yyy.zzz:zzz-components:Trunk works fine on SonarQube.

Any ideas how to resolve this issue?

Thanks

Hello,

What version of the SonarQube plugin are you using?

SonarQube Scanner 2.6.1

Hello everyone,
same problem here!

Jenkins version: 2.138.2
Sonarqube plugin version: 2.8.1

(sonarqube scan works fine but there is no link in the project page)

…another clue for debug the issue is the following:

12:22:00 12:22:00.735 INFO: ANALYSIS SUCCESSFUL, you can browse http://xxxx/dashboard?id=ASTERIX%3Aasterix 12:22:00 12:22:00.735 INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report 12:22:00 12:22:00.735 INFO: More about the report processing at http://xxxx/api/ce/task?id=AWndkecDLIkYidHRex6F 12:22:00 12:22:00.736

DEBUG: Report metadata written to /var/lib/jenkins/.jenkins/workspace/asterix/.scannerwork/report-task.txt

WARN: Unable to locate ‘report-task.txt’ in the workspace. Did the SonarScanner succedeed?

Hi,

To properly display link and quality gate widget on the job dashboard, the plugin needs 2 things:

  1. The plugin needs to get the analysis taskId. This taskId is stored in a file called report-task.txt by all SonarScanners (Maven, Gradle, CLI, MSbuild, …). Since the location of the file is unknown, we are looking in the entire job workspace (recursive find).
  2. Once the taskId is known, the plugin will query some WS to get the needed data. The credentials used to perform those calls are the same as the one used during the analysis, assuming they are configured in the global Jenkins configuration (and not directly passed on the command line with -Dsonar.login=xxx.

@valerio.fusco in your case it is failing on step 1. We already had this issue with people building project outside of the job workspace. A workaround is to copy the report-task.txt file into the job workspace just after the end of the analysis. Or you can also set the SonarScanner work directory to a folder in the job workspace (-Dsonar.working.directory=xxxxx).