To recap,
I've updated the stage to: 

stage ("SonarQube analysis") {
   steps {
      script {
         withSonarQubeEnv('SonarQube') {
            sh "../../../sonar-scanner-2.9.0.670/bin/sonar-scanner"   
         }
         
         def qualitygate = waitForQualityGate()
         if (qualitygate.status != "OK") {
            error "Pipeline aborted due to quality gate coverage failure: 
${qualitygate.status}"
         }
      }
   }
}

It might be that doing this in the same stage it not possible?
This fails with: 

java.lang.IllegalStateException: Unable to get SonarQube task id and/or 
> server name. Please use the 'withSonarQubeEnv' wrapper to run your analysis.


Under SonarQube servers section in the Jenkins settings I have: 
Name: SonarQube
Server: http://****:9000/sonarqube

In the console log I do see:

INFO: ANALYSIS SUCCESSFUL, you can browse 
> http://****:9000/sonarqube/dashboard/index/cert-mgmt-dashboard
> INFO: Note that you will be able to access the updated dashboard once the 
> server has processed the submitted analysis report
> INFO: More about the report processing at 
> http://****:9000/sonarqube/api/ce/task?id=AVr1S35oyohgD3UCfaIt


The second link has this: 

{"task":{"organization":"default-organization","id":"AVr1S35oyohgD3UCfaIt",
"type":"REPORT","componentId":"AVrnCD3cyohgD3UCfaG0","componentKey":"****",
"componentName":"****","componentQualifier":"TRK","analysisId":
"AVr1S4EhtEGQbCizBv8A","status":"SUCCESS","submittedAt":
"2017-03-22T11:14:09+0200","submitterLogin":"****","startedAt":
"2017-03-22T11:14:10+0200","executedAt":"2017-03-22T11:14:11+0200",
"executionTimeMs":473,"logs":false,"hasScannerContext":true}} 

What is missing, other than this being run on a slave (the build machine 
used by Jenkins is also the same machine used for the SonarQube server)?


On Wednesday, March 22, 2017 at 10:57:01 AM UTC+2, Julien HENRY wrote:
>
>
> 2017-03-22 9:42 GMT+01:00 Jan Fabry <jan....@thanksys.com <javascript:>>:
>
>> (but it's not always clear to me which
>> ones actually do that, and since which version)
>>
>
> See: 
> https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Jenkins#AnalyzingwithSonarQubeScannerforJenkins-AnalyzinginaJenkinspipeline
>
> It should work for:
>   - SQ Scanner 2.8+
>   - SQ Scanner for Maven 3.1+
>   - SQ Scanner for Gradle 2.1+
>
> It doesn't work currently with the Scanner for MSBuild.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/9fe415f6-4f2c-435f-b77c-8158082818e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to