gpt4 book ai didi

jenkins - waitForQualityGate() 失败,状态为 NONE

转载 作者:行者123 更新时间:2023-12-03 17:36:30 26 4
gpt4 key购买 nike

我正在使用 Jenkins 2.89、SonarQube Scanner for Jenkins 2.6.1 和 SonarQube 6.7 配置了一个 webhook 到 Jenkins。

我正在触发 Sonar 分析:

stage("SonarQube Analysis") {
script {
workspace = resolveWorkspacePath()
withEnv(["JAVA_HOME=${ tool 'java-8'}","PATH+MAVEN=${tool 'Maven 3.2.2'}/bin:${env.JAVA_HOME}/bin"]) {
withSonarQubeEnv('Sonar Solem') {
sh "mvn -f ${workspace}/pom.xml org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar -Dsonar.host.url=http://sonar.mycompany.cl"
}
}
}

然后在下一阶段收集状态:
stage("SonarQube Quality Gate") {
steps {
script {
timeout(time: 1, unit: 'HOURS') {
def qg = waitForQualityGate()
if (qg.status != 'OK') {
echo "Status: ${qg.status}"
error "Pipeline aborted due to quality gate failure: ${qg.status}"
}
}
}
}
}

登录控制台显示:
[Pipeline] script
[Pipeline] {
[Pipeline] timeout
Timeout set to expire in 1 hr 0 min
[Pipeline] {
[Pipeline] waitForQualityGate
Checking status of SonarQube task 'AV-nIGNjEMS3I3uac4Dq' on server 'Sonar MyCompany'
SonarQube task 'AV-nIGNjEMS3I3uac4Dq' status is 'IN_PROGRESS'
[Pipeline] echo
Status: NONE
[Pipeline] error
[Pipeline] }

查看日志记录级别,我看到具有正确有效负载的 SonarQube webhook POST:
Received POST from 10.0.0.236
Nov 10, 2017 3:27:06 PM FINE org.sonarsource.scanner.jenkins.pipeline.SonarQubeWebHook
Full details of the POST was {"serverUrl":"http://sonar.mycompany.cl","taskId":"AV-nLx-zEMS3I3uac4Ds","status":"SUCCESS","analysedAt":"2017-11-10T15:25:50-0300","changedAt":"2017-11-10T15:25:50-0300","project":{"key":"com.mycompany:mycomponent","name":"My Company Component","url":"http://sonar.mycompany.cl/dashboard?id=com.mycompany%3Amycomponent"},"branch":{"name":"master","type":"LONG","isMain":true,"url":"http://sonar.mycompany.cl/dashboard?id=com.mycompany%3Amycomponent"},"properties":{}}

我没有找到一个可行的解决方案,所以我想它对大多数人来说都是正确的。我对每个组件都使用最新版本,也许是回归?

问候

最佳答案

我遇到过类似的情况,waitForQualityGate() 失败,状态为 NONE。

查看控制台输出

[Pipeline] waitForQualityGate
Checking status of SonarQube task 'AWWpiDY2hX3zDQY-CMoe' on server 'Sonar1'
SonarQube task 'AWWpiDY2hX3zDQY-CMoe' status is 'SUCCESS'
SonarQube task 'AWWpiDY2hX3zDQY-CMoe' completed. Quality gate is 'NONE'

质量门是“无”???我不确定是什么原因造成的,因为之前的测试运行返回的质量门是“OK”。

查看 SonarQube 服务器,我注意到默认的 Quality Gate 'SonarQube Way' 未设置为默认值。在我的情况下,我只使用这个 Quality Gate。将此重置为默认值解决了我的问题。
[Pipeline] waitForQualityGate
Checking status of SonarQube task 'AWWpnnRThX3zDQY-CMpM' on server 'Sonar1'
SonarQube task 'AWWpnnRThX3zDQY-CMpM' status is 'PENDING'
SonarQube task 'AWWpnnRThX3zDQY-CMpM' status is 'SUCCESS'
SonarQube task 'AWWpnnRThX3zDQY-CMpM' completed. Quality gate is 'OK'

关于jenkins - waitForQualityGate() 失败,状态为 NONE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47229307/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com