I have been wanting some automated build and testing for MontySolr. Recently, after playing and reading around, tried out Hudson and am pretty happy with the results.
Firstly, the read-up made me to re-discover Joel’s blog and found the great Joel’s test. This blog post really made me think…
Installation of Hudson on Ubuntu doesn’t work at described in the official documentation, but it is fairly simple anyway:
wget http://java.net/projects/hudson/downloads/download/Debian/hudson-debian-2.2.0.deb sudo dpkg --install hudson-debian-2.2.0.deb
Maybe you’ll have to install daemon package as well
sudo apt-get install daemon
And then you have a hudson on the localhost:8080 (you can edit /etc/default/hudson to set a different port)
So then I created inside Hudson a “New Job” with the following parameters:
Source repository: git://github.com/romanchyla/montysolr.git Build triggers: Poll SCM Schedule: */6 * * * * #1 actions - execute shell: cp $WORKSPACE/build.properties.default $WORKSPACE/build.properties #2 action - execute Ant: target=build-all
Initially, there were a few errors (because on my dev machine I had some extra jars available), but I fixed that and now MontySolr builds cleanly inside Hudson.
And because I happened to sit in a plane above Atlantic while playing with Hudson, there was no internet and the build could not work. So I created a new Hudson job and directed it to my local Git repository. With a few more steps, this can be used to build MontySolr without any internet connection
#1 Go to Hudson and clone the existing Hudson project #2 Set Git: /dvt/workspace/montysolr #3 Add actions: - Execute shell: cp $WORKSPACE/build.properties.default $WORKSPACE/build.properties mkdir -p $WORKSPACE/build/solr-download cp /dvt/workspace/montysolr/build/solr-download/*.tgz $WORKSPACE/build/solr-download - Invoke Ant: untar-solr build-solr-example - Invoke Ant: build-all
Using this setup, Hudson grabs Solr form the dev folder (I assume it is there), downloads it without an internet connection, unpacks and then runs the standard ‘build-all’ target. This target can be very useful for the dev-machine development.