Skip to content
Script to remove all but the newest cruisecontrol builds
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Script to remove old cruise builds from all projects in the cruisecontrol directory.

sample crontab

To run the purge job nightly at midnight and store output in /tmp/pruned_cruise_builds.log:

0 0 * * * /home/cruise/bin/prune_cruise_builds.rb  >> /tmp/pruned_cruise_builds.log 2>&1

Or you can run from the shell by typing



Change one of these options in the script to match your needs

## change to the directory where cruise stores the projects on your server
CRUISE_PROJECTS_HOME = '/srv/cruise/projects'
## change this to keep more or fewer builds
BUILDS_TO_KEEP       = 10                     


For each project in the cruise project directory the script will

  • Find the most recent successful build
  • Count backward 10 builds from there (based on the BUILDS_TO_KEEP parameter)
  • Delete all builds older than that

It will always keep at least 10 builds and ensure it keeps the most recent successful build.


If you find this useful or want to enhance it please fork the project and submit a pull request or create an issue or drop me a line.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.