Search code examples
jenkinssonarqube

Link to SonarQube on Jenkins job not available


on the main page of a Jenkins job, I see the SonarQube icon, which should be a link, but it's just text: Jenkins job page with missing link

I use...

  • Jenkins 1.596.2 (also tried 1.609.1)
  • Jenkins SonarQube-Plugin 2.1 (also tried 2.2.1)
  • Maven 3.3.1
  • sonar-maven-plugin:2.6 (when configuring SonarQube post build action)
  • sonar runner 2.4 (when configuring SonarQube analysis build step)

After browsing the source code of the jenkins sonarqube-plugin, I found that SonarUtils.extractSonarProjectURLFromLogs() seems to be broken. It parses the console output for the regexp "ANALYSIS SUCCESSFUL, you can browse (.*)". My console output never prints this line. It just prints "ANALYSIS SUCCESSFUL".

Is this a known issue?


Solution

  • From what I can see in your logs, you are running the analysis in "preview" mode:

    ... -Dsonar.analysis.mode=preview ...
    

    As you can read on the documentation about preview mode:

    The source code is analyzed but the measures and issues are not pushed to the SonarQube database. Therefore, they cannot be browsed through the web interface.

    So this is normal that you only get a ANALYSIS SUCCESSFUL message without the related SQ URL (because results are not pushed to the server in preview mode).