Will reducing the Max # of builds to keep automatically delete old builds?

1,323 views
Skip to first unread message

Ed Young

unread,
Sep 13, 2012, 5:03:32 PM9/13/12
to jenkins...@googlegroups.com
I need to clear out some drive space on our build machine by deleting
old builds, but manually selecting each one and deleting it is too
painful.

If I change Max # of builds to keep from 100 to 10, will Jenkins
automatically delete the 90 that I no longer want, or do I need to
delete them by hand?

Scott Evans

unread,
Sep 13, 2012, 5:33:50 PM9/13/12
to jenkins...@googlegroups.com
Ed,

Based on my experience, it will purge old builds (by date or quantity) only when a new build of that type completes.  In your case, once you run one, it'll should automatically delete the 91 "extra" builds which are no longer within the retention policies for that build type.  Note that it will keep the last successful build, no matter how many failures you have, so it should always keep the most recent successful build, no matter how old.

Note that this might not occur properly with multiconfiguration builds, as I've seen them not clean up properly, but don't know if that's fixed recently or not.

Scott

Ed Young

unread,
Sep 13, 2012, 6:07:12 PM9/13/12
to jenkins...@googlegroups.com
Scott, kicking off the build seems to have deleted the old builds,
although I'm not seeing the diskspace usage go down the way I'm
hoping. I have a lot of builds to reconfigure and kick off though so
this make some time.

What do you mean by multiconfiguration builds?
--
- Ed

Lars Nordin

unread,
Sep 14, 2012, 8:11:08 AM9/14/12
to jenkins...@googlegroups.com
-----Original Message-----
From: Ed Young

Scott, kicking off the build seems to have deleted the old builds, although I'm not seeing the diskspace usage go down the way I'm hoping. I have a lot of builds to reconfigure and kick off though so this make some time.
-----Original Message-----

You might want to install the disk usage plug-in and it help you find what jobs and builds are consuming the most disk space.
https://wiki.jenkins-ci.org/display/JENKINS/Disk+Usage+Plugin

Ed Young

unread,
Sep 14, 2012, 9:39:21 AM9/14/12
to jenkins...@googlegroups.com
the disk usage plugin is installed and is what I've been using to
determine which projects (mine) are the biggest disk hogs.

One of my builds uses 18 GB of space. The next largest one is 1GB. The
reason it uses so much space is because I want keep 50 old builds
behind so that if I notice that test coverage has dropped, for
example, I can go back and see where that happened. I'm not sure of
any other way to track this kind of thing without keeping a large
number of builds.
--
- Ed

Chris Withers

unread,
Sep 14, 2012, 12:07:32 PM9/14/12
to jenkins...@googlegroups.com, Ed Young
Hi Ed,

Try the Workspace Cleanup Plugin and configure it to wipe out your
workspace after the build is done.

cheers,

Chris
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk

Chris_W...@dell.com

unread,
Sep 17, 2012, 12:12:37 PM9/17/12
to jenkins...@googlegroups.com

FYI,

You can also force log rotation (i.e. old build purging) to occur for all jobs by running this in the script console:

 

jenkins.model.Jenkins.instance.items.each { it.logRotate() }

 

 

-Chris

Ed Young

unread,
Sep 17, 2012, 12:47:30 PM9/17/12
to jenkins...@googlegroups.com
Excellent. I'd forgotten about the (groovy) console. Thanks!
--
- Ed

Sami Tikka

unread,
Sep 24, 2012, 4:59:12 PM9/24/12
to jenkins...@googlegroups.com
Disk usage plugin recalculates disk space usage based on a very, very lazy schedule. It is actually somewhat disk-intensive, so it is nice it doesn't run continuously.

Another way to save on disk space is to find the spot in job configuration where you configure the archived artifacts. Under it is a button titled Advanced. Click on that. More options will appear. Among them is an option to always delete old artifacts and only keep the latest. The job will still keep all the test results and other statistical history, only the artifacts are nuked (except the last).

I use this option on one of my jobs that produces 1 GB of artifacts for every build.

Of course it won't help if you need to keep more artifacts...... You can write a script that deletes the artifacts you do not need from the disk. Jenkins won't mind if they disappear.

-- Sami
Reply all
Reply to author
Forward
0 new messages