For the below pipeline script:
stage('stage1'){
withSonarQubeEnv(server){
sh "${scannerHome}/bin/sonar-scanner"
}
}
stage1
launches Sonar scan and exit with success state.
stage2
waits for 30 minutes until sonar scan completes, jenkins is suppose to receive QualityGate status, as per below code.
stage('stage2'){
timeout(time: 40, unit: 'MINUTES') {
def qGate = waitForQualityGate()
if (qGate.status != 'OK') {
error "Pipeline aborted due to quality gate failure: ${qGate.status}"
}
}
}
We have Sonar server and sonar scanner configured in Jenkins.
Is there additional configuration required to receive quality gate status?
To make it work you need:
withSonarQubeEnv(nameofyourconfiguredSonarHost)
work After that it should work as expected. In my experience a timeout of 10 mins is sufficient.
Maybe there are additional settings needed, ie proxy or firewall to be able to access Jenkins from Sonarqube - it depends on your network.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.