How to delete old Jenkins builds on repository branches
Certain job properties are adjusted using directives in Jenkinsfiles and not the configuration in the web UI. In your Jenkinsfile:
properties([
// only keep 25 builds to prevent disk usage from growing out of control
buildDiscarder(
logRotator(
artifactDaysToKeepStr: '',
artifactNumToKeepStr: '',
daysToKeepStr: '',
numToKeepStr: '25',
),
),
])
You may of course adjust the various parameters to suit your needs.