2016-07-12 124 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