The script is attached to this issue. You need to change the "bamboo_url" variable to point to your Bamboo server URL, obviously. By default, this script doesn't do anything it just shows you what it would do. It make it do something, use the --run flag. Also, it doesn't delete things immediately, normally: instead it moves them into a different directory (.oldbuilds) just in case. There's a --clean option which deletes the previous contents of .oldbuilds before cleaning new stuff. And, you need to pass a the directory to be checked as the argument: by default it checks BUILDDIR in the user's home directory, which I make a symlink to point to the workspace directory (not on Windows of course
).
Basically I run the script in a cron job with --run --clean; this will clean out builds from the previous run, then clean new builds, once a day. This gives me a day to recover a build if, somehow, it got removed by accident (note, this has never happened to us, not once, but...)
One other safety feature: because we decide a build is no good if we can't access its page on the bamboo server, if the script discovers that ALL the builds are marked for deletion it will not do anything, because it figures that something is wrong with the bamboo server or your access to it.
it's highly ironic that the bamboo remote agents lack this very very very very (repeat 100 times) basic feature while Bamboo licensing strategy is based on how many remote agents you have...