Saturday, March 22, 2008

Hudson's so Groovy

Having used Cruise Control for almost 4 years, when I started looking at Hudson last week, I was impressed seeing how easy it was to configure and get it up and running in just a few minutes. It also has several plugins available, and if you don't find one you can quickly write one as well.

Andrew Glover, in the TestEarly Blog, shows us how to use Groovy with Hudson. Hudson has a Groovy plug-in which can execute Groovy Scripts.


To quote from the blog "as a part of a CI project setup, another dependent
project’s directories were becoming read-only due to an SCM feature.
Consequently, a child project couldn’t write to the filesystem.

This problem was easily solved using Groovy (plus a little Ant)– a triggered build executes a small Groovy script that uses Ant’s chmod
task to make target directories read-write enabled. As you can see, the
fix requires 2 lines of code (which could, arguably, be reduced to one)"

def ant = new AntBuilder()
ant.chmod(dir:"./ci09_i/ui/rep2/reports/", perm:"ugo+rw",
includes:"**/*.*")

You can read the complete story at TestEarly.com

Isn't that cool? However, I am not sure if there is a way to specify Hudson to run the Groovy Script first before executing any build script or vice versa, any ideas?

Here are some useful links for additional reading:

1. TestEarly.com

2. thediscoblog.com

No comments:

Post a Comment