We are trying to have Jenkins jobs show results of sonarqube analysis.
For that, we have installed the sonarqube Scanner plugin in Jenkins.
The jobs for which we are most interested to see sonarqube results in Jenkins are gating jobs which are triggered for each push or merge-request.
Our gating jobs run sonar analysis via a gradle task.
We followed the docs and have the following set:
- In the gating job configuration we have the following checkbox checked: Prepare SonarQube Scanner environment.
- A webhook configured for the project in sonarqube,
On the Jenkins job page we only see links to sonarqube (these links correctly point to the analysis of the relevant git branch on the sonarqube server):
However, the Jenkins job page does not show any widget with analysis status like the docs suggest:
Once the job is complete, the plugin will detect that a SonarQube analysis was made during the build and display a badge and a widget on the job page with a link to the SonarQube dashboard as well as quality gate status.
I assume that because we are using a Freestyle Jenkins job which invokes sonar analysis via a gradle task, the job does not get the SonarQube
taskId attached to its context and therefore when sonarqube calls the Jenkins webhook, Jenkins does not know with which job to associate the received analysis result.
Is there a way to configure the Jenkins plugin to work correctly with a Jenkins Freestyle job and show the analysis status?
SonarQube Enterprise Edition version 7.9.1
SonarQube Scanner for Jenkins version 2.12
Jenkins version 2.222.1
sonarqube-gradle-plugin version 3.0
Gradle version 6.6.1