sonar qualitygate failed

1,343 views
Skip to first unread message

sri...@gmail.com

unread,
Jun 8, 2017, 4:55:32 PM6/8/17
to SonarQube
Hi,

we recently upgrade sonarqube from 5.6 to 6.3.1 to implement quality gate feature.


It looks like there's a few pre-reqs for using this method which we implemented though:

  • updated Sonar Scanner on the Jenkins server to 2.8 
  • SonarQube server 6.3 
  • Configured a webhook in r SonarQube server pointing to < Jenkins instance>/sonarqube-webhook/ 

·         Used withSonarQubeEnv step in the pipeline (so that SonarQube taskId is correctly attached to the pipeline context).


Added this in our pipeline

   }

      //-----------------------------------

// Sonar Qulaity Gate

//-----------------------------------

      

stage("Quality Gate"){

  timeout(time: 1, unit: 'HOURS') { // Just in case something goes wrong, pipeline will be killed after a timeout

  def qg = waitForQualityGate() // Reuse taskId previously collected by withSonarQubeEnv

 

            if (qg.status != 'OK') {

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

                } else {

echo 'Quality Gate PASSED'

}

}

  }


we have implemented above and initiated the build with errors in code. It doesnt work.  Need your inputs.


Thanks,

Srikanth 

sri...@gmail.com

unread,
Jun 8, 2017, 5:00:06 PM6/8/17
to SonarQube, sri...@gmail.com
Below is the output:
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
[Bitbucket] Notifying commit build result
[Bitbucket] Build result notified
java.lang.NoSuchMethodError: No such DSL method 'withSonarQubeEnv' found among steps [archive, bat, build, catchError, checkout, checkpoint, copyRemoteArtifacts, deleteDir, dir, dockerFingerprintFrom, dockerFingerprintRun, echo, error, fileExists, findFiles, git, input, isUnix, jiraComment, jiraIssueSelector, jiraSearch, libraryResource, load, mail, milestone, nexusArtifactUploader, node, parallel, properties, pwd, readFile, readManifest, readMavenPom, readProperties, readTrusted, retry, sh, sleep, sshagent, stage, stash, step, timeout, tool, touch, triggerRemoteJob, unarchive, unstash, unzip, waitUntil, withCredentials, withDockerContainer, withDockerRegistry, withDockerServer, withEnv, wrap, writeFile, writeMavenPom, ws, zip] or symbols [all, always, ant, antFromApache, antOutcome, antTarget, apiToken, architecture, archiveArtifacts, artifactManager, batchFile, booleanParam, buildButton, buildDiscarder, caseInsensitive, caseSensitive, choice, choiceParam, clock, cloud, command, cron, crumb, defaultView, demand, disableConcurrentBuilds, downloadSettings, downstream, dumb, envVars, file, fileParam, filePath, fingerprint, frameOptions, freeStyle, freeStyleJob, hyperlink, hyperlinkToModels, installSource, jdk, jdkInstaller, jnlp, jobName, junit, lastDuration, lastFailure, lastGrantedAuthorities, lastStable, lastSuccess, legacy, list, local, location, logRotator, loggedInUsersCanDoAnything, masterBuild, maven, maven3Mojos, mavenErrors, mavenMojos, mavenWarnings, myView, nodeProperties, nonStoredPasswordParam, none, overrideIndexTriggers, paneStatus, parameters, password, pattern, pipelineTriggers, plainText, plugin, projectNamingStrategy, proxy, queueItemAuthenticator, quietPeriod, run, runParam, schedule, scm, scmRetryCount, search, security, shell, slave, stackTrace, standard, status, string, stringParam, swapSpace, text, textParam, tmpSpace, toolLocation, unsecured, upstream, viewsTabBar, weather, zfs, zip] or globals [currentBuild, docker, env, params, scm]


Thanks,
Srikanth 

sri...@gmail.com

unread,
Jun 12, 2017, 10:13:29 AM6/12/17
to SonarQube, sri...@gmail.com
can anyone please do respond to this? Thanks in advance..!!

Best Regards,
Srikanth 


On Thursday, June 8, 2017 at 4:55:32 PM UTC-4, sri...@gmail.com wrote:

sri...@gmail.com

unread,
Jun 12, 2017, 3:59:38 PM6/12/17
to SonarQube, sri...@gmail.com
Why this post is ignored?

G. Ann Campbell

unread,
Jun 13, 2017, 8:34:18 AM6/13/17
to SonarQube, sri...@gmail.com
Hi Srikanth,

To answer your most recent question, your title's not terribly evocative. Nor is your initial message very communicative. Your addition of some logs in the second message is more helpful, but it would have been even better to tell us where they came from. (sonar.log? web.log? analysis log?)

Nonetheless, it was fair of you to bump the thread yesterday. But to follow that up only 6 hours later with petulance wins you no friends here. And as it says in the group welcome message, "operators are not standing by." The relevant developers do monitor this group, but they have day jobs as, presumably, does every other member of this community. This is an at-best undertaking.


Ann

G. Ann Campbell

unread,
Jun 15, 2017, 8:39:48 AM6/15/17
to SonarQube, sri...@gmail.com
Hi,

Can you please clarify the version of your SonarQube Scanner for Jenkins?


Thx,
Ann

srikanth p

unread,
Jun 15, 2017, 8:42:36 AM6/15/17
to G. Ann Campbell, SonarQube
Hi Ann,

Below are the details 
Sonar scanner version is 2.8.1.
Sonarqube version-6.3


Thanks,
Srikanth 

--
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/730c_cl4Xxk/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/599ee06c-0970-41d4-aecf-b3d7c1b2723a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

G. Ann Campbell

unread,
Jun 15, 2017, 8:48:58 AM6/15/17
to SonarQube, ann.ca...@sonarsource.com, sri...@gmail.com
Hi Srikanth,

I'm asking about the version of your Jenkins plugin. The highest released version of that is 2.6.1. Also, can you confirm that you're building with gradle? If that's the case, you probably need to change your build command to this:

sh './gradlew --info sonarqube'
(Found in this group thread)


Ann
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.

sri...@gmail.com

unread,
Jun 15, 2017, 11:17:26 AM6/15/17
to SonarQube, ann.ca...@sonarsource.com, sri...@gmail.com
Hi Ann,

please find the attachment we are using sonar-scanner-2.8. I think this is the latest version.

Thanks,
Srikanth 

To unsubscribe from this group and all its topics, send an email to sonarqube+...@googlegroups.com.

srikanth p

unread,
Jun 15, 2017, 5:47:30 PM6/15/17
to SonarQube, ann.ca...@sonarsource.com
Hi Ann,
Do we need to install quality gates plugin in Jenkins ? Is this necessary ?

Thanks, 
Srikanth 

G. Ann Campbell

unread,
Jun 16, 2017, 7:45:42 AM6/16/17
to srikanth p, SonarQube
Hi Srikanth,

No probably not. Repeating from my last response:

I'm asking about the version of your Jenkins plugin. The highest released version of that is 2.6.1. Also, can you confirm that you're building with gradle? 


Ann 



---
G. Ann Campbell | SonarSource
Product Manager
@GAnnCampbell

To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/CAPeMyvwfmygLCmzkzsQdCy-or4LmdykwctUkQuvkHvD3Jh5KJw%40mail.gmail.com.

saraniya.b...@gmail.com

unread,
Aug 9, 2017, 11:44:25 AM8/9/17
to SonarQube, sri...@gmail.com
I am using Sonar 6.3 and Jenkins. When I configure  Sonar Quality Gates plugin in Jenkins and try to run , I get the below error- 

quality.gates.jenkins.plugin.QGException: Expected status 200, got: 401. Response:

at quality.gates.sonar.api.SonarHttpRequester.executeGetRequest(SonarHttpRequester.java:59)


I read that Sonar 6.3 doesn't support quality gate plugins. And got an hpi which I uploaded in Jenkins. But still getting same error.
Please help...

On Thursday, June 8, 2017 at 4:55:32 PM UTC-4, sri...@gmail.com wrote:

G. Ann Campbell

unread,
Aug 9, 2017, 1:10:27 PM8/9/17
to SonarQube, sri...@gmail.com, saraniya.b...@gmail.com
Hi,

First, please be aware that the standard courtesies (Hi, Thanks, ...) are appreciated in this group.

Second, please don't excavate old threads. You should start a new thread for this.


Ann
Reply all
Reply to author
Forward
0 new messages