【问题标题】:Set Build to Unstable status if Quality Gates fails如果 Quality Gates 失败,请将 Build 设置为 Unstable 状态
【发布时间】:2021-03-09 17:21:58
【问题描述】:

我需要一些帮助,如果 sonarqube 上的质量门失败,我正在尝试将构建状态设置为“不稳定”。在下面找到我到目前为止的配置:

Stage sonarQube Scan

我也发现了这个,但我不知道如何在上面的舞台上集成:

step {                     
                qualitygate = waitForQualityGate()                     
                if (qualitygate.status != "OK") {                         
                    currentBuild.result = "UNSTABLE"                     
                }                 
            }  

有什么建议吗? 提前感谢您的支持,

【问题讨论】:

  • 请在问题中包含您的代码,而不是代码的屏幕截图。

标签: jenkins jenkins-pipeline sonarqube-scan jenkins-declarative-pipeline


【解决方案1】:

试试这个:

...
timeout(25) {
    def qualitygate = waitForQualityGate()
    if (qualitygate.status != "OK") {
        currentBuild.result = "UNSTABLE" 
    }
}

灵感来自Set the build unstable if sonar Quality Gate is failed

【讨论】:

    猜你喜欢
    • 2022-12-09
    • 2017-10-20
    • 1970-01-01
    • 1970-01-01
    • 2018-06-08
    • 2011-08-02
    • 2022-11-13
    • 2014-02-19
    • 2022-10-16
    相关资源
    最近更新 更多