Here’s a python script for cleaning up your artifacts dir. Posted by Phill (apparently doesn’t like to share his last name). Just put it somewhere sensible and slot into crontab.
#! /usr/bin/env python
# ==== Variables ====
ARTIFACTS_DIR="/opt/cruisecontrol/artifacts/"
NUM_BUILDS_TO_KEEP=10
# ==== End Variables ====
import os
def rm_recursive(path):
"""Removes a directory recursively"""
for root, dirs, files in os.walk(path, topdown=False):
for name in files:
os.remove(os.path.join(root, name))
for name in dirs:
os.rmdir(os.path.join(root, name))
#os.rmdir(path)
def delete_old_builds(path):
"""Deletes old builds"""
builds = os.listdir(path)
if len(builds) <= NUM_BUILDS_TO_KEEP:
print "No builds to delete"
return
builds.sort()
builds.reverse()
i = 0
for build in builds:
i += 1
if i <= NUM_BUILDS_TO_KEEP:
continue
print "Deleting", build
rm_recursive(os.path.join(path, build))
for file in os.listdir(ARTIFACTS_DIR):
path = os.path.join(ARTIFACTS_DIR, file)
if (os.path.isdir(path)):
delete_old_builds(path)
]]>More to follow tomorrow!
]]>
I’m not normally one to partake of stealing posts from other blogs, but this is just too good to resist.
Lifted from FailBlog.org
]]>
I’m not normally one to partake of stealing posts from other blogs, but this is just too good to resist.
Lifted from FailBlog.org
]]>Obviously you’ll need to configure the script for your environment and allocate appropriate permissions. When you’re done, drop it into /etc/init.d/ and CruiseControl will automatically start during your server’s init routines. Also, when trying to stop the process, rather than scanning ps output trying to find the correct pid to kill, you just run:
# sudo /etc/init.d/cruisecontrol stop]]>
With official interest rates likely to increase by one billion percent in the second half of 2008, the RBA is advising potential pista-riders to get into the market while they can.
(previously: PistaDex)
]]>* There’s no easy way to start and stop Cruise Control. You’ll need to add an init script for starting/stopping/restarting. I’ll post mine here eventually.
* Disc Space: Builds can potentially use up a ton of the stuff. Make sure you have plenty of room, and/or, an easy way to shutdown the CC process if you find yourself running out of disc space.
* Configuration changes require a restart/reload to take affect. This should be second-nature if you’re used to configuring apache etc. Having said this, it caught me out a couple of times.
* You can configure builds to be triggered only where code changes have been merged to your svn sources. This saves heaps of unnecessary disc writing etc.
* Be careful using relative file paths. I’m still looking into how Ant handles file paths, but it definitely seems to be inconsistent. I’m using absolute paths in my build.xml & config.xml config files.
* If commands in your build process are failing, check the contents of /path/to/cruisecontrol/cruisecontrol.log - This will detail the exact commands being run by cruisecontrol.
* To test your build.xml configuration for a specific project run /path/to/cruisecontrol/apacheAnt-Version/bin/ant from within the project directory. Do this before restarting the cruisecontrol process to avoid builds failing because config errors.
]]>
I’m building a bike! Bought a frame through Ebay last week which should be arriving any day now. More pics from the build will turn up here.
]]>
I’m building a bike! Bought a frame through Ebay last week which should be arriving any day now. More pics from the build will turn up here.
]]>
“Everyone talks about their hobbies and what they do for fun. Cycling, though, is much more than a hobby for me. It’s a giant reset button. I can be having the worst day ever; after ninety minutes on a bike, I’ve got my balance back.”