title: Sonarqube quality gate status check fail in Jenkins pipeline
body: <p>Im new to jenkins pipeline scripting and sonarqube. it would be great if I can get some help with the question below.
  I want to fail the Jenkins declarative pipeline job when quality gate check fails.  As per sonar documentation (<a href="https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-jenkins/#header-6" rel="nofollow noreferrer">https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-jenkins/#header-6</a>), I tried with below two scenrions but both are seems not working and failing with errors.
  sonarqube analysis is working fine but it failing at QualityGate check. I created webhook in sonarserver which is returning json output. Not sure what Im missing here.
  Version I using Sonrscanner version - 3.0.0.702</p>
  
  <h2>scenario 1:</h2>
  
  <p>Getting error “Invalid parameter “abortPipeline”, did you mean “null”?” when run below code. I saprated with </p>
  
  <pre><code>stage('Sonarqube Analysis') {
              environment {
                  scannerHome = tool 'ALM Sonar'
              }
              steps {
                  withSonarQubeEnv('ALM Prod Sonar') {
                      sh "${scannerHome}/bin/sonar-scanner"
                  }
              }
          }
          stage("Quality Gate") {
              steps {
                  timeout(time: 1, unit: 'HOURS') {
                  waitForQualityGate abortPipeline: true }
              }
          }
  </code></pre>
  
  <h2>scenario 2:</h2>
  
  <p>Getting error “Invalid JSON String”. Below analysis, its going till the “test2” further its failing to read status waitForQualityGate(). Please advise.
  I put the script quality gate in saparate stage still its failing with same error.</p>
  
  <pre><code>stage('Sonarqube Analysis') {
              environment {
                  scannerHome = tool 'ALM Sonar'
              }
              steps {
                  withSonarQubeEnv('ALM Prod Sonar') {
                      sh "${scannerHome}/bin/sonar-scanner"
                    }
                  sleep time: 30000, unit: 'MILLISECONDS'
                  echo "test1"
                  script {
                          echo "test2"
                          def qg = waitForQualityGate()
                          if (qg.status != 'OK') {
                              error "Pipeline aborted due to quality gate failure: ${qg.status}"
                              echo "test3" }
                      }
                  }
          }
  </code></pre>