Hi,

I have been trying to get SonarQube Quality gate to work with latest 
blueocean on Jenkins, but it does not seem to work.  I am a beginner with 
blueocean pipeline so any help in fixing this issue would be greatly 
appreciated.   Please, note the build works and sonarqube report is 
generated, but only failing at SonarQube Quality Gate status.  I thought 
this would work out of the box as blueocean now as an added Step to add 
SonarQube QG status.

I have tried all of the various different steps, but I still get following 
same error "Unable to get SonarQube task id and/or server name. Please use 
the 'withSonarQubeEnv' wrapper to run your analysis."

---------

pipeline {

  agent any

  stages {

    stage('Build') {

      steps {

        sh 'mvn install clean install -Dsonar.login=test 
-Dsonar.password=test -Dsonar.host.url=http://myserver sonar:sonar '

      }

    }

    stage('Quality Gate') {

      steps {

        sh 'echo "Sonar Analysis"'

        waitForQualityGate()

      }

    }


---------

    stage('Quality Gate') {

      steps {

        sh 'echo "Sonar Analysis"'

        withSonarQubeEnv('http://myserver') 

        waitForQualityGate()


      }

    }

-----------------

   stage('Quality Gate') {

      steps {

        sh 'echo "Sonar Analysis"'

        withSonarQubeEnv('http:myserver') 

        def qualitygate = waitForQualityGate()

        if (qualitygate.status != "OK") {

         error "Pipeline aborted due to quality gate coverage failure: 
${qualitygate.status}"

      }

    }



------------


pipeline {

  agent any

      environment {

        withSonarQubeEnv = 'http://myserver/'

    }

  stages {

    stage('Build') {

steps {

sh 'mvn install  -Dsonar.login=test -Dsonar.password=test 
-Dsonar.host.url=http:myserver/ sonar:sonar '

  }

  }

    stage('Quality Gate') {

      steps {

        sh 'echo "Sonar Analysis"'

        waitForQualityGate()

    }

  }



------------

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/f7ea7565-7a0e-4c4d-8fdd-e99f418ca6ff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to