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...


On Wednesday, February 22, 2017 at 10:02:30 AM UTC-5, Julien HENRY wrote:
>
> 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:
>
> https://repox.sonarsource.com/sonarsource-public-builds/org/jenkins-ci/plugins/sonar/2.6-build1166/sonar-2.6-build1166.hpi
>
> Documentation is available directly on the step in the pipeline snippet 
> generator.
>
> Feedback period is open until Friday.
>
> Regards,
>
> Julien
>

-- 
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/19027f4d-2246-4c35-b71c-9a9ef20abee2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to