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:
…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%3Aasterix12: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=AWndkecDLIkYidHRex6F12: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?
To properly display link and quality gate widget on the job dashboard, the plugin needs 2 things:
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).
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).