Thursday, 4 November 2010

Hudson -Continuous Integration Tool

I have used Hudson tools for the past 2 years, so i thought why not write about it features. It is a great tool and first thing i like about Hudson is the User friendly Web interface.Hudson has lot of features but i know a very few from the  user perspective that's what i will discuss here.

Before Going in to the details of Hudson ,let me describe my understanding of Continuous Integration, it is a process where the scheduled polling are done on the SCM like subversion,Git,CVS  repositories for changes .If there is a change then the latest source code is checked out and the build happens,if the build fails during compilation then the committers are notified  about the build failure . Once the build got completed, the tests are triggered to check the stability of the build. So it gives a quick process to check the build stability and fix it soon thus preventing the delay in product deliveries.

I have installed hudson in Redhat Linux and windows, below are the steps i did,

java -jar hudson.war --httpPort=8080  #this will make hudson to run in  port 8080

Once the Hudson is up then all the setup is done via web UI itself and Hudson has tons of plugins  like SCM plugins, Test report , Irc notifier, Email, Access control, Build wrappers.

Manage Hudson gives a Central configuration Management page for the Hudson Server where you can configure the Access control for Hudson, project based authorization, Irc notification, Email Notification. In my setup i run Hudson in CentOS with 4GB mem and 250GB hard disk.

I used Hudson in Master/Slave mode .Means i run Hudson server in one machine(Master) and configure individual machine as slave for it and run each job in that machine .The slave configuration is done in the Manage Node page . In windows, slave machine needs is launched via JNLP(Java Network Launching protocol) and in Linux using SSH(Secure Shell protocol) and slave machine need to have a directory dedicated to Hudson,you can also run multiple jobs in one slave)

Hudson directory structure in slave machine : ls /u1/hudson/workspace

madhu-job1  madhu-job2 madhu-job3   #I have three jobs running in this  slave

Create a job in New Job page, i used to create a Build a free-style software project. After job is created configure the job by Allocating a slave to the job. Specify the repository URL in the Source Code Management section also use Poll SCM to mention how frequent the Hudson need to poll the repository.

Next Add Build Step to specify how to build the checked out source code, it has various options like Execute shell, ANT, Maven, python script , Groovy script, Windows batch command. I use Execute shell to run the build script as most of my builds are Linux based.

No comments:

Post a Comment