I have multi-branch pipeline job in Jenkins:
http://illinXXXX:XXXX/job/OC/configure
and I checked the option for Discard old builds as below:
I would have expected, that each new run after this change, it will delete old build from the server for each Repository inside that pipeline. however, I see all builds are still there, which causing me a File system issue. Jenkins link:
http://illinXXX:XXXX/job/OC/job/productconfigurator-ms/job/master/
From server:
jenkins@XXXXX:jenkins/jenkins-production/jobs/OC/jobs/productconfigurator-ms/branches/master/builds>
I see builds from 541 to 1039
Jenkins ver. 2.176.1
The interface you pasted is for the Orphaned items. Orphaned items refer to deleted branches, where no Jenkinsfile is available.
For the Multibranch pipeline, the instructions to build each branch are inside that branch's Jenkinsfile. This is where you need to define these limits.
Use the following in your Jenkinsfile (from above, in master
branch):
options {
buildDiscarder(logRotator(numToKeepStr: "100"))
}
Make sure to use string (as in "100"
) and not number (as in 100
).
Parameters:
daysToKeepStr
: history is only kept up to this many days.numToKeepStr
: only this many build logs are kept.artifactDaysToKeepStr
: artifacts are only kept up to this many days.artifactNumToKeepStr
: only this many builds have their artifacts kept.You may need to run your master
pipeline manually once for it to work.