【问题标题】:jenkins pipeline options timeout and then notifyjenkins 管道选项超时然后通知
【发布时间】:2018-10-26 14:13:38
【问题描述】:

我已经使用了

options {
        timeout(time: 10, unit: 'MINUTES') 
    }

但我希望能够对超时采取措施,例如 slackNotification 等

有什么办法可以做到这一点

【问题讨论】:

    标签: jenkins notifications timeout jenkins-pipeline declarative


    【解决方案1】:

    使用 post 部分和 aborted 条件,因为您的管道在超时时中止。您可以在中止条件中添加更多逻辑,以便仅对由于超时而不是由于用户手动中止而发生的中止执行您的操作。

    post { 
        aborted{ 
            // action on timeout
        }
    }
    

    【讨论】:

    • 我试图将构建结果覆盖为不稳定,以防超时,但这显然在这种情况下无效。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-01
    • 1970-01-01
    • 2021-05-17
    • 2023-03-05
    • 1970-01-01
    • 2019-04-12
    相关资源
    最近更新 更多