Using pipeline code,
stage ('SonarQube') {
withSonarQubeEnv {
dir ('mydir/') {
sh "'${mvnHome}/bin/mvn' sonar:sonar -Dsonar.login=something -Dsonar.projectKey=someproj -Dsonar.projectName=somename"
}
}
timeout(time: 15, unit: 'MINUTES') {
def qg = waitForQualityGate()
if (qg.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
Which progresses crrectly over the first mvn section and breaks on waitforqualitygate() operation:
org.sonarqube.ws.client.HttpException: Error 401 on http://mysonarserver/sonar/api/ce/task?id=somecode
the link is clickable and leads to a filled json structure.
Why the build fails? Webhook seems to be set properly in sonar, and other sonar projects are working correctly, webhook in jenkis also seems to be active.