It looks like there's a few pre-reqs for using this method which we implemented though:
< 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
[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]
--
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.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to sonarqube+...@googlegroups.com.
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?
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.
quality.gates.jenkins.plugin.QGException: Expected status 200, got: 401. Response:
at quality.gates.sonar.api.SonarHttpRequester.executeGetRequest(SonarHttpRequester.java:59)