Status: Reopened (View Workflow)
Currently Jenkinsfile Runner does not support passing timeout to CLI. In Docker it may be worked around by timing out the Docker container, but in such case there is no way to have a graceful shutdown.
timeout() is not enough, because Jenkins may hang before Pipeline even starts.
- There is a soft and hard timeout options which may be set via CLI argument or passed via Environment variable (for Docker)
- If the option is set, timeout is applied to the execution
- Once the soft timeout happens, Jenkins instance termination is invoked (job termination and then instance shutdown)
- Once the hard timeout happens, Jenkins instance is forcefully aborted
What is the use case for this? The Jenkinsfile may already include a timeout step which performs a graceful termination of nested steps (including processing of StepExecution.stop, finally blocks, SimpleBuildWrapper.Disposer, etc.); and a global hard timeout as a defense against Pipeline infrastructure bugs (for example some pathological cases of
JENKINS-39072: see TimeoutStepTest.veryUnresponsiveBody) can be accomplished with /usr/bin/timeout, Kubernetes configuration, etc.