每当构建卡在某处失败时,超时就会启动,但构建不会中止,并且它会一直运行,直到您取消构建,进入控制台并按链接单击此处以强制终止运行步骤
这是一个我正在尝试但不工作的示例代码:
stage concurrency: 1, name: 'Build'
def buildSteps = [:]
buildSteps['Server'] = {
timeout(1) {
node('build') {
timestamps {
bat "waitfor nothing /t 120 >nul"
}
}
}
}
parallel buildSteps
这是日志
[Pipeline] stage (Build)
Entering stage Build
Proceeding
[Pipeline] parallel
[Pipeline] [Server] { (Branch: Server)
[Pipeline] [Server] timeout
[Pipeline] [Server] {
[Pipeline] [Server] node
[Server] Running on CI106 in C:\Jws\workspace\jftimeout
[Pipeline] [Server] {
[Pipeline] [Server] timestamps
[Pipeline] [Server] {
[Pipeline] [Server] bat
14:42:52 [Server] [jftimeout] Running batch script
14:42:53 [Server]
14:42:53 [Server] C:\Jws\workspace\jftimeout>waitfor nothing /t 120 1>nul
14:43:52 [Server] Sending interrupt signal to process
Aborted by user
14:49:29 [Server] Sending interrupt signal to process
Click here to forcibly terminate running steps
Terminating bat
[Pipeline] }
[Pipeline] // timestamps
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // timeout
[Pipeline] }
Failed in branch Server
[Pipeline] // parallel
[Pipeline] End of Pipeline
在14:43:52,超时发送停止信号,但没有任何反应.
在Aborted by user是我手动取消构建时
最佳答案 安装构建超时插件
https://wiki.jenkins-ci.org/display/JENKINS/Build-timeout+Plugin
转到Manage Jenkins>配置系统>构建超时插件> BuildStep Action>选中“启用BuildStep操作”
启用插件后,在达到超时时停止构建.