Jenkins · Declarative pipeline basics
Set pipeline options
Add a timeout, keep fewer builds and stop on the first failure.
options {
timeout(time: 30, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr: '20'))
disableConcurrentBuilds()
}
Official Jenkins documentation
More declarative pipeline basics commands
- A minimal Jenkinsfile
- Run in a Docker container
- Set environment variables
- Ask for parameters
- Run on a schedule
- Run a stage conditionally
All declarative pipeline basics commands · Jenkins cheatsheet