Must-share information (formatted with Markdown):
- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)?
SonarQube * Version 7.1 (build 11001)
- what are you trying to achieve?
I want to initiate a scan of my source code from a Jenkins pipeline and have the results show up under that project/branch in sonarqube.
- what have you tried so far to achieve this?
I am initiating a processing run from Jenkins by way of Maven. In one stage of my pipeline, I run the following maven command
mvn -Dsonar.branch.name=${scmVars.GIT_BRANCH} org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar
The scan submits and runs. A URL is returned to Jenkins in the log as
[INFO] ANALYSIS SUCCESSFUL, you can browse http://code-quality.my-devops.com/dashboard/index/com.company:api-xyz
When I click through to that link, I can see results for an old scan of the master branch, but not the branch name I used to submit the job. There is a red banner across the top saying The last analysis has failed
.
There is another link of the form http://code-quality.my-devops.com/api/ce/task?id=VIIyT0jLAWWmnGLyGhcd which shows a JSON document like the following.
{
"task": {
"id": "VIIyT0jLAWWmnGLyGhcd",
"type": "REPORT",
"componentId": "AWNBs4Gefnkf2xGjvefC",
"componentKey": "com.company:api-xyz",
"componentName": "api-xyz",
"componentQualifier": "TRK",
"analysisId": "AWWmVIhpsjXSQABH-Bo0",
"status": "SUCCESS",
"submittedAt": "2018-09-04T20:44:40+0000",
"submitterLogin": "jenkins",
"startedAt": "2018-09-04T20:44:42+0000",
"executedAt": "2018-09-04T20:44:42+0000",
"executionTimeMs": 411,
"logs": false,
"hasScannerContext": true,
"organization": "default-organization",
"branch": "feature/jenkins",
"branchType": "SHORT"
}
}
The following screenshot shows that the jenkins jobs are submitted, but they never show up in the actual results or under the specified branch.
How can I get the results of the scan to show up under that project/branch in sonarqube?