SonarQube Scanner for Jenkins: getQualityGateWithAnalysisId() - Missing sonar.organization parameter

244 views
Skip to first unread message

johannes.s...@triology.de

unread,
Dec 22, 2017, 3:48:49 AM12/22/17
to SonarQube
I'm using sonarcloud.io with maven as described here: https://about.sonarcloud.io/get-started/
I trigger the analysis on a Jenkins Pipeline using SonarQube Scanner for Jenkins v2.6.1.

When running the sonar:sonar goal, I'm passing parameters including the `sonar.organization` to maven.

The analysis runs successfully.

However, when calling waitForQualityGate(), an error occurrs.

The log is as follows:

Checking status of SonarQube task 'AWB4XGTBFTEFvoJcI7XP' on server 'sonarcloud.io'
SonarQube task 'AWB4XGTBFTEFvoJcI7XP' status is 'SUCCESS'
[Pipeline] }
[Pipeline] // timeout
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
org.sonarqube.ws.client.HttpException: Error 404 on https://sonarcloud.io/api/qualitygates/project_status?analysisId=AWB4XGZj1Wq2otfdKJO0
    at org.sonarqube.ws.client.BaseResponse.failIfNotSuccessful(BaseResponse.java:34)
    at hudson.plugins.sonar.client.HttpClient.getHttp(HttpClient.java:36)
    at hudson.plugins.sonar.client.WsClient.getQualityGateWithAnalysisId(WsClient.java:85)


This is correct: The URL returns 404. However, when adding `&organization=triologygmbh` the URLs returns the expected QG status:
https://sonarcloud.io/api/qualitygates/project_status?analysisId=AWB4XGZj1Wq2otfdKJO0&organization=triologygmbh

This is the Jenkinsfile: https://github.com/triologygmbh/command-bus/blob/feature/3_continuous_delivery/Jenkinsfile#L50
It uses a build lib method that's basically a wrapper around waitForQualityGate(): https://github.com/cloudogu/ces-build-lib/blob/develop/src/com/cloudogu/ces/cesbuildlib/SonarQube.groovy#L63
Here's the Jenkins console: https://opensource.triology.de/jenkins/job/triologygmbh-github/job/command-bus/job/feature%252F3_continuous_delivery/26/console


Am I missing something here?
If not, could you please add the organization parameter to getQualityGateWithAnalysisId() or provide a parameter to the Jenkins step?

Julien Lancelot

unread,
Dec 22, 2017, 4:03:06 AM12/22/17
to johannes.s...@triology.de, SonarQube
Hi Johannes,

Sorry for this issue, it should be fixed very soon on SonarCloud : 

The organization paramter will be removed from the api/qualitygates/project_status, so no need to update anything.

Sorry again for the trouble.
Regards,

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/033ed8bc-f2b3-4918-b62b-ede6b2a8f9f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Julien Lancelot | SonarSource

Julien Lancelot

unread,
Dec 22, 2017, 4:03:51 AM12/22/17
to johannes.s...@triology.de, SonarQube
In fact it's already fixed on SonarCloud !

johannes.s...@triology.de

unread,
Dec 22, 2017, 4:08:17 AM12/22/17
to SonarQube
Hi Julien,

thanks for your fast response. I can confirm it works now. Thanks!

Best regards,
Johannes
Reply all
Reply to author
Forward
0 new messages