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.
The Default Build Discarder
can be added here:
Manage Jenkins >> Configure System >> Global Build Discarders
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"
Adding a job specific discarder will
make sure the Default Build Discarder
is not applicable.
# Jenkinsfile
pipeline {
options {
buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '30'))
}
...
}
The build in Specific Build Discarder discards build independent of specific job discarders.
See the default contribution guidelines for Jenkins
Start Jenkins by running this command
mvn hpi:run