Introduction
A global build discarder that's possible to override by adding a job specific discarder. The goal is to be able to have a global sensible default, that's possible to override if needed.
Getting started
The Default Build Discarder
can be added here:
Manage Jenkins >> Configure System >> Global Build Discarders
Configuration as Code
Add defaultBuildDiscarder
to your configuredBuildDiscarders
with the standard logRotator
settings.
unclassified:
buildDiscarders:
configuredBuildDiscarders:
- "jobBuildDiscarder"
- defaultBuildDiscarder:
discarder:
logRotator:
artifactDaysToKeepStr: "50"
artifactNumToKeepStr: "5"
daysToKeepStr: "100"
numToKeepStr: "10"
Override the settings with a job specific discarder
Adding a job specific discarder will make sure the Default Build Discarder
is not applicable.
# Jenkinsfile
pipeline {
options {
buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '30'))
}
...
}
Background
The build in Specific Build Discarder discards build independent of specific job discarders.
Contributing
See the default contribution guidelines for Jenkins