Archive for the 'CI' Category

 

Cleaning Up After CruiseControl

Jul 06, 2008 in CI

CI builds tend to generate a *lot* of output. With CruiseControl that’s no problem in itself, but you’ll probably want to purge old build artifacts periodically to avoid maxing out on disc usage.

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)

PHPUnderControl Install Guide

Jun 22, 2008 in CI, PHP

Lately I’ve been doing some work with PHPUnderControl. It’s based on the Cruise Control Continuous Integration framework, which in turn, is based on Ant. It combines PHPUnit, PHPDocumentor & CodeSniffer to build & test software projects. It works pretty well, though there were a few mysteries along the way to getting an install up and running. I’m in the middle of preparing a comprehensive how-to, but meanwhile, here are a few notes I made about the installation & configuration process.

* 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.

CITCON

May 11, 2008 in CI, Conferences

CITCON (Continuous Integration & Testing Conference) is a free conference being held in Melbourne this June. CI certainly seems to be a hot topic at the moment & I’m hoping to pick up some tips for my own efforts with PHP Under Control.

Here’s the official release:

Melbourne is hosting a free technical conference in June. The conference is called CITCON, Continuous Integration and Testing conference. There is no cost, we just want people to contribute to discussions and presentations.



The Open Information Foundation, co-founded by Jeffrey Fredrick and Paul Julius, presents CITCON Asia/Pacific 2007 in Sydney, Australia.
CITCON (Continuous Integration and Testing Conference) brings together people from every corner of the software development industry to discuss Continuous Integration and the type of Testing that goes along with it.

What: OpenSpace event discussing all aspects of CI and Testing, together
Where: TBD, Melbourne, Australia
When: June 27 & 28, 2008 (Friday night and Saturday)
Who: Everyone interested in CI and Testing
Cost: Free

I’ve also blogged on it. http://www.testingreflections.com/node/view/6886

After a great conference in Sydney last year, The Continuous Integration and Testing conference (CITCON) is coming to Melbourne in 2008. It’s an open space conference where we all meet the night before to propose and vote for sessions then spend Saturday sharing ideas and experiences, presenting, discussing and demoing. It was an amazing experience last year. The Denver CITCON has just happened (http://citconf.com/wiki/index.php?title=CITCONDenver2008Sessions) and June is not far away.



The venue is being decided but it is central Melbourne. Best of all this is a free conference, running on sponsorship. Last year folk came from the US, NZ and around Australia, and everyone thought it was great. Registration numbers are a little low at the moment compared to the past conferences in Europe and the US and even Sydney, so if you want to come, register now. http://citconf.com/melbourne2008/
Venue should be announced shortly.



Please circulate this amongst interested folk….

cheers,

Erik Petersen

http://www.testingspot.net/