2016-07-12 92 views
4

每当构建卡住失败时,超时会启动,但构建不会中止,并且会一直运行,直到您取消构建,进入控制台并按链接Click here to forcibly terminate running stepsAbort Jenkins管道(工作流)在超时后编译

这里是我想要一个示例代码,但不工作:

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 

在十四时43分52秒第超时发送停止信号,但没有任何反应。

Aborted by user是,当我手动取消构建

回答

2

安装生成超时插件https://wiki.jenkins-ci.org/display/JENKINS/Build-timeout+Plugin 转到管理詹金斯>配置系统>内置超时插件> BuildStep行动>选中启用BuildStep行动

后我启用了插件,当超时达到时停止构建。

+0

这是不正确的。管道的超时与Build-timeout插件无关。 https://issues.jenkins-ci.org/browse/JENKINS-34677 – Daniel