waitForQualityGate()返回401,因为该URL来自我在Jenkins上第一个配置的SonarQube服务器。而不是我配置要使用的那个?
如果我手动将URL更改为其他服务器,则会返回有效的json。
这是我的代码:(在正确的服务器上分析成功)
node {
gitReference = checkout scm
gitURL = gitReference.GIT_URL.replace('.git', '');
gitURL += "/commit/${gitReference.GIT_COMMIT}"
println("###> GIT Commit: ${gitURL}")
measureDuration(script: this, measurementName: 'sonar_duration') {
println("###> Execute Sonar Scan START")
executeSonarScan(script: this, instance: 'sonarqube-my-second-server', options: "-Dsonar.projectVersion=${gitReference.GIT_COMMIT}", useWebhook: true)
println("###> Sonar Scan Finished FINISHED")
}
}
// No need to occupy a node
stage("Quality Gate"){
timeout(time: 1, unit: 'HOURS') { // Just in case something goes wrong, pipeline will be killed after a timeout
waitForQualityGate()
}
}
有人知道为什么会这样吗?