Nov 20, 2017

Discard Old Builds on Jenkins

 By default, you can enable the “Discard Old Builds” in each project/job’s configuration page.


Navigate to $JENKINS_HOME/jobs/<jobname>/builds
folder for each project, and delete some or all of the files inside here (which comprise the build history). Following the deletion, it
will be necessary to restart Jenkins or “Reload Configuration from Disk” (both in “Manage Jenkins”) so the links to the deleted
builds will disappear.

It’s also possible to purge selectively from the filesystem using “find $dir -mtime +$age -rm” where age is the oldest date
you want to keep the build (in days).