Name the `options` you use in almost every production pipeline.
IntermediateConceptDeclarative pipeline syntax
Answer
options {
timeout(time: 45, unit: 'MINUTES')
buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '5'))
disableConcurrentBuilds(abortPrevious: true)
timestamps() // timestamper plugin; or ansiColor('xterm')
skipDefaultCheckout() // when you checkout explicitly
durabilityHint('PERFORMANCE_OPTIMIZED')
retry(1) // at stage level, for flaky infra
}
disableConcurrentBuilds(abortPrevious: true) is very useful for PR builds: a new push cancels the outdated build.
More on Declarative pipeline syntax
What is the minimum valid declarative pipeline?BeginnerWhat agent types exist in declarative pipelines?IntermediateWhen do you use `agent none` at the top level?IntermediateHow do nested sequential stages work and why are they useful?IntermediateList the `post` conditions and when each fires.IntermediateWhat are the most useful `when` conditions?Intermediate