[RFF] SonarQube Scanner for Jenkins 2.6

1,217 views
Skip to first unread message

Julien HENRY

unread,
Feb 22, 2017, 10:02:30 AM2/22/17
to jenkin...@googlegroups.com, SonarQube
Hi,

I would like to collect feedback before the upcoming release of the SonarQube Scanner for Jenkins.

The main new feature is that we introduced a new pipeline step that would put the pipeline in pause until SonarQube analysis is finished, and the step will then give access to the quality gate status. You can then implement any logic you want.

Example:
      stage("build & SonarQube analysis") {
          node {
              withSonarQubeEnv('My SonarQube Server') {
                 sh 'mvn clean package sonar:sonar'
              }    
          }
      }
      
      stage("Quality Gate"){
          timeout(time: 1, unit: 'HOURS') {
              def qg = waitForQualityGate()
              if (qg.status != 'OK') {
                  error "Pipeline aborted due to quality gate failure: ${qg.status}"
              }
          }
      }

You can test using this artifact:

Documentation is available directly on the step in the pipeline snippet generator.

Feedback period is open until Friday.

Regards,

Julien

Arnaud Héritier

unread,
Feb 22, 2017, 10:53:14 AM2/22/17
to jenkin...@googlegroups.com, SonarQube
Myself I like it !!

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/CAD9wyxEpf977L%3DxpzxaBZ0qMqOPO2CDQDEym7ue8MUGimhM2sQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--
-----
Arnaud Héritier
Mail/GTalk: aheritier AT gmail DOT com
Twitter/Skype : aheritier

Jesse Glick

unread,
Feb 22, 2017, 11:23:06 AM2/22/17
to Jenkins Dev
On Wed, Feb 22, 2017 at 10:02 AM, Julien HENRY
<julien...@sonarsource.com> wrote:
> I would like to collect feedback before the upcoming release of the
> SonarQube Scanner for Jenkins.

Left some code review comments for you.

Tim Downey

unread,
Feb 22, 2017, 12:13:08 PM2/22/17
to Jenkins Developers, sona...@googlegroups.com
Hi Julien,

This is terrific, but I'm having issues.  I'm trying to use this within a pipeline model definition build.  I'm struggling with `waitForQualityGate`.  Wherever I put it, I'm getting an exception.  I've tried the `waitForQualityGate` both in the same and in separate stages.  Any suggestions?

java.lang.IllegalStateException: Unable to get SonarQube task id and/or server name. If you are not using the 'withSonarQubeEnv' wrapper to run your analysis, you have to pass the attributes manually to this step.
        at org
.sonarsource.scanner.jenkins.pipeline.WaitForQualityGateStep$Execution.processStepParameters(WaitForQualityGateStep.java:127)
        at org
.sonarsource.scanner.jenkins.pipeline.WaitForQualityGateStep$Execution.start(WaitForQualityGateStep.java:107)

        stage('sonar-build') {

            steps {
                script {
                    withSonarQubeEnv('VantageSonar') {
                        sh 'mvn clean package sonar:sonar'

                        def qg = waitForQualityGate()
                        if (qg.status != 'OK') {
                          error "Pipeline aborted due to quality gate failure: ${qg.status}"
                        }
                    }
                }
            }
        }Enter code here...

Jesse Glick

unread,
Feb 22, 2017, 1:07:04 PM2/22/17
to Jenkins Dev
On Wed, Feb 22, 2017 at 12:13 PM, Tim Downey <timothy...@gmail.com> wrote:
> steps {
> script {
> withSonarQubeEnv('VantageSonar') {
> sh 'mvn clean package sonar:sonar'
> def qg = waitForQualityGate()
> if (qg.status != 'OK') {
> error "Pipeline aborted due to quality gate failure: ${qg.status}"
> }
> }
> }
> }

BTW if the step had an option to return void but mark the build
`UNSTABLE` where appropriate, you could write more simply

steps {
withSonarQubeEnv(…) {
sh '…'
waitForQualityGate markBuildUnstable: true
}
}

which the round-trip GUI editor could handle because there would be no
need for a `script` block.

Julien HENRY

unread,
Feb 24, 2017, 11:42:29 AM2/24/17
to SonarQube, jenkin...@googlegroups.com, timothy...@gmail.com
Hi Tim,

The step waitForQualityGate has to be used outside withSonarQubeEnv. Also remember that the purpose is to not occupy a Jenkins executor during the wait, so your sh step should be in a node, but not the waitForQualityGate.

HTH

Julien

georg....@netcentric.biz

unread,
Feb 28, 2017, 8:02:33 AM2/28/17
to SonarQube, jenkin...@googlegroups.com
Hi Julien, 

this feature is nice but it has been easily possible to achieve the same with https://github.com/SonarQubeCommunity/sonar-build-breaker (or https://github.com/AmadeusITGroup/sonar-stash that we use ATM). 

A lot more important would be the long-standing issue https://jira.sonarsource.com/browse/SONAR-6763 - any news when quality gates on incremental (or if not incremental, at least on "non-server-side-saving") sonar runs will be possible?

Best Regards
Georg

Laurent Tourreau

unread,
Mar 2, 2017, 1:58:45 PM3/2/17
to SonarQube, georg....@netcentric.biz, jenkin...@googlegroups.com
Hi all

I am trying this wonderful feature in a Jenkins Pipeline. The webhook is not able to communicate to Jenkins (i get HTTP 403) as consequence the answer is not sent to Jenkins and it wait until the timeout. Here is the REST API result:


api
/webhooks/deliveries result:

{"deliveries":[{"id":"AVqQTJiMvUKPnZt1PZie","componentKey":"com.mycompany:web-app","ceTaskId":"AVqQTI00uNSR7Z9AqVMA","name":"Jenkins
ATI"
,"url":"http://jenkins.mycompany.com:8080/jenkins/sonarqube-webhook/","at":"2017-03-02T19:33:43+0100","success":false,"httpStatus":403,"durationMs":7}]}


api/webhooks/delivery result:

{"delivery":{"id":"AVqQTJiMvUKPnZt1PZie","componentKey":"com.mycompany:web-app","ceTaskId":"AVqQTI00uNSR7Z9AqVMA","name":"Jenkins
ATI"
,"url":"http://jenkins.mycompany.com:8080/jenkins/sonarqube-webhook/","at":"2017-03-02T19:33:43+0100","success":false,"httpStatus":403,"durationMs":7,"payload":"{\"taskId\":\"AVqQTI00uNSR7Z9AqVMA\",\"status\":\"SUCCESS\",\"analysedAt\":\"2017-03-02T19:33:34+0100\",\"project\":{\"key\":\"com.mycompany:web-app\",\"name\":\"com.mycompany:web-app\"},\"qualityGate\":{\"name\":\"SonarQube
way\",\"status\":\"OK\",\"conditions\":[{\"metric\":\"new_security_rating\",\"operator\":\"GREATER_THAN\",\"value\":\"1\",\"status\":\"OK\",\"onLeakPeriod\":true,\"errorThreshold\":\"1\"},{\"metric\":\"new_reliability_rating\",\"operator\":\"GREATER_THAN\",\"value\":\"1\",\"status\":\"OK\",\"onLeakPeriod\":true,\"errorThreshold\":\"1\"},{\"metric\":\"new_maintainability_rating\",\"operator\":\"GREATER_THAN\",\"value\":\"1\",\"status\":\"OK\",\"onLeakPeriod\":true,\"errorThreshold\":\"1\"},{\"metric\":\"new_coverage\",\"operator\":\"LESS_THAN\",\"status\":\"NO_VALUE\",\"onLeakPeriod\":true,\"errorThreshold\":\"80\"}]},\"properties\":{}}"
}}


I have disabled Jenkins security -> same result.
The webhook http://jenkins.mycompany.com:8080/jenkins/sonarqube-webhook is configured on Configuration->General Settings -> Webhooks tab

How can we find the root cause?

Regards

Laurent TOURREAU

Laurent Tourreau

unread,
Mar 3, 2017, 5:03:43 AM3/3/17
to SonarQube, georg....@netcentric.biz, jenkin...@googlegroups.com
Hi SonarQube Team

I find the culprit : the corporate proxy.
We have configured http.proxy variables in sonar.properties (to allow the plugin upgrade from Update Center).
The problem is by setting this our Jenkins instance cannot be reachable since it use the proxy.

I disable the proxy settings (toggling comment on them) -> it works SonarQube is able to send the webhook request. I can see Jenkins receiving it.

We should use proxy exclusion variable but such variable doesn't exist in sonar.properties:

http.proxyExclude
https.proxyExclude

Can you book a JIRA to add exclusion for proxy (HTTP and HTTPS)?

Regards

Laurent TOURREAU

Julien HENRY

unread,
Mar 3, 2017, 7:36:28 AM3/3/17
to Jenkins Developers, sona...@googlegroups.com
Hi Georg,


Le mardi 28 février 2017 14:02:33 UTC+1, georg....@netcentric.biz a écrit :
Hi Julien, 

this feature is nice but it has been easily possible to achieve the same with https://github.com/SonarQubeCommunity/sonar-build-breaker

Build breaker was using polling, which has several drawback. That's why we were not supporting it. Also here you get the status in your pipeline script. You can decide to implement any logic, not always fail the build. For example use the input step to ask for a manual user confirmation before moving the pipeline forward.
I don't consider that reporting issues on a pull request and getting quality gate status in your Jenkins pipeline are similar features.
 

A lot more important would be the long-standing issue https://jira.sonarsource.com/browse/SONAR-6763 - any news when quality gates on incremental (or if not incremental, at least on "non-server-side-saving") sonar runs will be possible?

That's a different topic, so I will not respond here.

Arvid Huss

unread,
Mar 14, 2017, 5:11:40 AM3/14/17
to Jenkins Developers, sona...@googlegroups.com, timothy...@gmail.com
Hi Julien,

I am facing exactly the same behaviour as Tim describes, the difference with my setup is that it works for a single Jenkins server setup but not in a Jenkins master/slave environment. When I run my pipeline script on the master/slave jenkins I get the IllegalStateException!  waitForQualityGate fails since it cannot find either server or task id from the previous analysis. 

Is there any workaround for this?

brg
Arvid

Julien HENRY

unread,
Mar 14, 2017, 5:25:58 AM3/14/17
to jenkin...@googlegroups.com, SonarQube, timothy...@gmail.com
Hi Arvid,

Could you please share your pipeline script? Remember that waitForQualityGate should be used after/outside withSonarQubeEnv closure.

withSonarQubeEnv() {
   xxx
}
def qg = waitForQualityGate()

++

Julien

Julien HENRY

unread,
Mar 17, 2017, 11:59:11 AM3/17/17
to SonarQube, jenkin...@googlegroups.com, timothy...@gmail.com, jan....@thanksys.com
Hi Jan,

Le mercredi 15 mars 2017 11:11:30 UTC+1, jan....@thanksys.com a écrit :
*Should* the waitForQualityGate be outside a node, or *must* it be outside of a node? We have some existing scripts which use a single node scope for the whole script, and would like to integrate the quality gate with minimal changes. The extra wait time is no issue at the moment.

It *should* be outside a node
but
It *must* be outside the withSonarQubeEnv closure (since collecting analysis id is done at the end of the closure).

I was not able to reproduce the problem, so please try to produce a sample reproducer (with precise Jenkins version, number of slaves, and of course the pipeline script).

Thanks

Julien
 

We also have the "Unable to get task id" issue, not sure whether this is related? It's also not clear to me yet how I should start debugging it (I'm looking at the Java code of the plugin, but I'm not sure how many structures I can access in my Jenkinsfile to print their values, e.g. to get the SonarAnalysisAction).

Regards,

Jan Fabry

Idan Adar

unread,
Mar 20, 2017, 6:46:56 PM3/20/17
to SonarQube, jenkin...@googlegroups.com
I'd like to join the growing number of users unable to make this work...

Jenkins 2.5
SonarQube 6.2
1 master and 1 slave machine

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


stage ("SonarQube analysis") {
     steps {
        script {
           STAGE_NAME = "SonarQube analysis"

           if (BRANCH_NAME == "develop") {
              echo "In 'develop' branch, don't analyze."
           }
           else { // this is a PR build, run sonar analysis
              withSonarQubeEnv("SonarGate") {
                 sh "../../../sonar-scanner-2.9.0.670/bin/sonar-scanner"   
              }
           }
        }
     }
  }

  stage ("SonarQube Gatekeeper") {
     steps {
        script {
           STAGE_NAME = "SonarQube Gatekeeper"

           if (BRANCH_NAME == "develop") {
              echo "In 'develop' branch, skip."
           }
           else { // this is a PR build, fail on threshold spill
              def qualitygate = waitForQualityGate()
              if (qualitygate.status != "OK") {
                 error "Pipeline aborted due to quality gate coverage failure: ${qualitygate.status}"
              } 
           }
        }
     }
  }


I did also post more information on StackOverflow, but given that there hasn't been any interaction there, I'll just mention here as well...

Julien HENRY

unread,
Mar 21, 2017, 4:29:40 AM3/21/17
to jenkin...@googlegroups.com, SonarQube
Hi,

Can you tell me what is this "steps" keyword? When I try to use it I get 
NoSuchMethodError: No such DSL method 'steps'

Also, what is the point of the script block?

In short, what happen if you simplify your script to:

stage ("SonarQube analysis") {
           STAGE_NAME = "SonarQube analysis"

           if (BRANCH_NAME == "develop") {
              echo "In 'develop' branch, don't analyze."
           }
           else { // this is a PR build, run sonar analysis
              withSonarQubeEnv("SonarGate") {
                 sh "../../../sonar-scanner-2.9.0.670/bin/sonar-scanner"   
              }
           }
  }

  stage ("SonarQube Gatekeeper") {
           STAGE_NAME = "SonarQube Gatekeeper"

           if (BRANCH_NAME == "develop") {
              echo "In 'develop' branch, skip."
           }
           else { // this is a PR build, fail on threshold spill
              def qualitygate = waitForQualityGate()
              if (qualitygate.status != "OK") {
                 error "Pipeline aborted due to quality gate coverage failure: ${qualitygate.status}"
              } 
           }
  }


--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/7so6S2mAhzg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/20c139a7-1e33-48d0-a9ae-ca5512f28785%40googlegroups.com.

Tim Downey

unread,
Mar 21, 2017, 7:24:05 AM3/21/17
to jenkin...@googlegroups.com, SonarQube
Hi Julien,

'steps' is part of declarative pipeline which is becoming the recommendation from the Jenkins folks on how to write your Jenkinsfiles.


Tim

Julien HENRY

unread,
Mar 21, 2017, 8:41:16 AM3/21/17
to jenkin...@googlegroups.com, SonarQube
OK, I did a test with a declarative pipeline, and it works fine. Here is my sample pipeline. Can you try on your own instance and see how it goes (you have to replace bold values by your own)?

pipeline {
    agent none
    stages {
        stage("build & SonarQube Scan") {
            agent any
            steps {
              git changelog: false, poll: false, url: 'https://github.com/SonarQubeCommunity/sonar-clirr.git'
              script {
                  withEnv(["JAVA_HOME=${ tool '8u121' }", "PATH+MAVEN=${tool '3.3.9'}/bin:${env.JAVA_HOME}/bin"]) {
                    withSonarQubeEnv('localhost') {
                       sh 'mvn clean package sonar:sonar -DskipTests'
                    }    
                  }
              }
            }
        }
        
        stage("Quality Gate") {
            steps {
                timeout(time: 1, unit: 'HOURS') {
                    script  {

Jesse Glick

unread,
Mar 21, 2017, 9:42:18 AM3/21/17
to Jenkins Dev
On Tue, Mar 21, 2017 at 8:40 AM, Julien HENRY
<julien...@sonarsource.com> wrote:
> script {

Should not be necessary AFAIK—you can use block-scoped steps like
`withSonarQubeEnv`.

> withEnv(["JAVA_HOME=${ tool '8u121' }", "PATH+MAVEN=${tool '3.3.9'}/bin:${env.JAVA_HOME}/bin"]) {

`tools` section

> script {
> def qg = waitForQualityGate()
> if (qg.status != 'OK') {
> error "Pipeline aborted due to quality gate failure: ${qg.status}"

This part is not Declarative-friendly. You could add an option to
`waitForQualityGate` to set the build result to `UNSTABLE`.

Julien HENRY

unread,
Mar 21, 2017, 10:27:56 AM3/21/17
to jenkin...@googlegroups.com
2017-03-21 14:42 GMT+01:00 Jesse Glick <jgl...@cloudbees.com>:
On Tue, Mar 21, 2017 at 8:40 AM, Julien HENRY
<julien...@sonarsource.com> wrote:
> script {

Should not be necessary AFAIK—you can use block-scoped steps like
`withSonarQubeEnv`.

> withEnv(["JAVA_HOME=${ tool '8u121' }", "PATH+MAVEN=${tool '3.3.9'}/bin:${env.JAVA_HOME}/bin"]) {

`tools` section

Indeed, it works fine without script block. 

> script  {
>   def qg = waitForQualityGate()
>   if (qg.status != 'OK') {
>     error "Pipeline aborted due to quality gate failure: ${qg.status}"

This part is not Declarative-friendly. You could add an option to
`waitForQualityGate` to set the build result to `UNSTABLE`.

Still that doesn't explain why the "communication" between the withSonarQubeEnv and the waitForQualityGate steps is not working for some people.

Jesse, withSonarQubeEnv is a SimpleBuildWrapper. We attach to it a Disposer that collect some properties, and attach them to the build using an InvisibleAction. Then later the waitForQualityGate step try to read it back to get the values. For some people it seems to fail somewhere, in a mater/slave configuration. I was not able to reproduce but are you aware of any problem with this approach?

Thanks

Julien

Julien HENRY

unread,
Mar 21, 2017, 3:45:48 PM3/21/17
to Jan Fabry, jenkin...@googlegroups.com, SonarQube
Hi Jan,

I think I understand why it doesn't work with Gradle.

2017-03-21 19:32 GMT+01:00 Jan Fabry <jan....@thanksys.com>:
Let me know if  you want any other tests.

Please try to run sh './gradlew --info sonarqube' and I guess it should work.

++

Julien

Julien HENRY

unread,
Mar 22, 2017, 3:52:31 AM3/22/17
to Jan Fabry, jenkin...@googlegroups.com, SonarQube
Hi Jan,

Thanks for confirming my guess about log parsing. I think we need to provide a more robust solution for Gradle users. sonar-scanner users should be unaffected since logs should be there.

Still we need to understand the master/slave issue. As I said, I already tried the master/slave scenario (ok, the slave is on the same machine, but I don't see why this would affect the process).

After the end of the withSonarQubeEnv closure (and assuming log parsing was working), we should have collected server URL and taskId, and stored them in a Jenkins "action". It should be visible in the build.xml of the build. Something like:

<hudson.plugins.sonar.action.SonarAnalysisAction plugin="so...@2.7-SNAPSHOT">
      <installationName>localhost</installationName>
      <ceTaskId>AVrxNskUNRuu9JoQMGou</ceTaskId>
      <isNew>true</isNew>
      <isSkipped>false</isSkipped>
</hudson.plugins.sonar.action.SonarAnalysisAction>

Can you confirm that you see this in your master/slave test?

Thanks

Julien

2017-03-22 8:38 GMT+01:00 Jan Fabry <jan....@thanksys.com>:
This does not work if you run it on a slave. If I change the "agent
any" to "agent { label: "some-slave" }", then it fails for me. My
setup has one master (Linux) and one slave (macOS). Both can reach the
SonarQube server. The badge in the build history does link to the
SonarQube project, so that part is parsed successfully.


Idan Adar

unread,
Mar 22, 2017, 4:35:20 AM3/22/17
to SonarQube, julien...@sonarsource.com, jenkin...@googlegroups.com, jan....@thanksys.com
Question: what should  withSonarQubeEnv("SonarGate") use? should the text "sonargate" change to the label of the slave machine or is it a reference to a value in the Jenkins settings?

On Tuesday, March 21, 2017 at 8:33:20 PM UTC+2, Jan Fabry wrote:
Hello Julien,

Is it possible that this only works for Maven projects?

I was able to run your example, and then I tried the Spring Boot "Getting started" example (from https://github.com/spring-guides/gs-spring-boot/tree/master/complete). If I build it via Maven it works, if I do it via Gradle it doesn't.

I tried it on Jenkins 2.48 and Jenkins 2.51, with SonarQube Scanner plugin 2.6. I tested this with a multibranch project, with the Jenkinsfile in the repository. If you want to try it yourself you have to change the complete/build.gradle file to include the SonarQube plugin.

This was my Jenkinsfile (Gradle version):

#!groovy

pipeline {
    agent none
    stages {
        stage("build & SonarQube Scan") {
            agent any
            steps {
              checkout scm
              script {
                dir('complete') {
                  withEnv(["JAVA_HOME=${ tool '<Java tool>' }", "PATH+JAVA=${env.JAVA_HOME}/bin"]) {
                    withSonarQubeEnv('<SonarQube environment>') {
                       sh './gradlew sonarqube'
                    }    
                  }
                }
              }
            }
        }
        
        stage("Quality Gate") {
            steps {
                timeout(time: 1, unit: 'HOURS') {
                    script  {
                        def qg = waitForQualityGate()
                        if (qg.status != 'OK') {
                            error "Pipeline aborted due to quality gate failure: ${qg.status}"
                        }
                    }
                }
            }
        }
    }
}
Let me know if  you want any other tests.

Regards,

Jan Fabry

To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/7so6S2mAhzg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/7so6S2mAhzg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/z_K_wz_8Vw8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/CAD9wyxEf%2BR_tbPQwfCUYnrw8DW5ftePsfsP%2B5QLzEXSW4z4nuA%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.



--
Jan Fabry
Operations
+32 484 03 89 15

Julien HENRY

unread,
Mar 22, 2017, 4:57:05 AM3/22/17
to Jan Fabry, Idan Adar, SonarQube, jenkin...@googlegroups.com

2017-03-22 9:42 GMT+01:00 Jan Fabry <jan....@thanksys.com>:
(but it's not always clear to me which
ones actually do that, and since which version)


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.

Idan Adar

unread,
Mar 22, 2017, 5:23:41 AM3/22/17
to SonarQube, jan....@thanksys.com, id...@adar.me, jenkin...@googlegroups.com
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)?

Julien HENRY

unread,
Mar 22, 2017, 6:20:14 AM3/22/17
to jenkin...@googlegroups.com, SonarQube, Jan Fabry, Idan Adar
Guys,

I was finally able to reproduce. Here is the ticket for details:

We will release a bugfix quickly for this specific problem.
The issue with Gradle will deserve more thinking and a dedicated sprint. BTW there is a workaround (--info) so that's not a blocker issue.

Thanks again for your feedback and help to investigate the issue. I will probably ask you to test the bugfix version before releasing it.

++

Julien

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-dev/7so6S2mAhzg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-dev+unsubscribe@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.

Julien HENRY

unread,
Mar 22, 2017, 10:53:18 AM3/22/17
to jenkin...@googlegroups.com, SonarQube, Jan Fabry, Idan Adar
Here is a release candidate fixing the issue with master/slave behavior:

Could you please test it and confirm that it solves your problems?

Thanks

Julien

Idan Adar

unread,
Mar 22, 2017, 11:22:26 AM3/22/17
to SonarQube, jenkin...@googlegroups.com, jan....@thanksys.com, id...@adar.me
I can confirm that in my case the updated plug-in now works!
To unsubscribe from this group and all its topics, send an email to jenkinsci-de...@googlegroups.com.

Julien HENRY

unread,
Mar 23, 2017, 5:27:54 AM3/23/17
to jenkin...@googlegroups.com, SonarQube, Jan Fabry, Idan Adar
Thanks Idan, we'll release 2.6.1.

To unsubscribe from this group and all its topics, send an email to jenkinsci-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/6415f21e-3570-4440-b043-0192746d59fa%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages