Abort Jenkins pipeline (workflow) after timeout

Whenever an assembly is stuck, a timeout fails somewhere, but the assembly does not interrupt, and it gets stuck forever until you cancel the assembly, go to the console and click the link Click here to forcibly terminate running steps

Here is an example of the code I'm trying but not working:

stage concurrency: 1, name: 'Build'
def buildSteps = [:]
    buildSteps['Server'] = {
        timeout(1) {
            node('build') {
                timestamps {
                     bat "waitfor nothing /t 120 >nul"
            }
        }
    }   
}

parallel buildSteps

This is a magazine.

[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

At 14:43:52, the timeout sends a stop signal, but nothing happens.

This Aborted by useris when I manually canceled the assembly

+4
source share
1 answer

- https://wiki.jenkins-ci.org/display/JENKINS/Build-timeout+Plugin " Jenkins" > " " > " --" > " BuildStep" > " BuildStep

, , ​​ -.

+2

All Articles