Wednesday, September 26, 2012

Create Multi-OS jobs with Hudson




I've been making some improvements to our use of Hudson recently, that have been really helpful.

One of this was using the multi-configuration jobs. You can create number of Hudson jobs to be tied to 1 particular host/platform. Though it seems quick, you might just end up creating 1 job for each platform, increasing the no. of jobs.

So there are times, you would like to think a bit and setup 1 job that could run your builds/tests across multiple platforms, on multiple hosts etc.

Here, I would like to show how to set up Multi-OS jobs in Hudson, that I used for my project.

Let say, you want to configure your job across multiple *nix variants, that would look something like below -











Here is how you go about creating it.

Go to Hudson web console (which would be something like <your Hudson server name:port>)

Go to 'Manage Hudson' -> 'Manage nodes' -> Add node -> Add a Dumb Slave -> opens up a configuration page. While configuring your slaves add the 'label' that represents the OS the slave is running for ex. oel, rhel, suse, debian etc (see below). 























Add all the slaves (OSs) you want your tests to run on.
Now click 'New Job' -> choose 'Build multi-configuration project' (see below)
















 

which opens up a configure job window for you, where you choose your Source Code Management You can also choose the 'Build Trigger' as 'Poll SCM' or 'Build periodically' etc.
Now the main important configuration here is 'Configuration Matrix' (see below)
 











Choose 'Slaves' Axis for choosing the slaves (test boxes/VMs) you want to run your tests on. You can choose 'Labels' or 'Individual nodes' based on what you would like to be displayed on the result page ('Labels' seemed better to me as that displayed the OS variant name). When you choose 'Labels', you would see all the labels you have attached to your slaves while configuring.

You might also want to choose the option 'Tie parent build to a node' (see below)




























Now choose your 'Build step' (I have chosen 'Execute shell') , add the code and save the job. Remember if you are running across *nix/windows, the same Build step won't work. But here as it is just different *nix variants I could easily choose 'Execute shell'.

Job done :). The generated matrix and result page looks as below - 
  

No comments:

Post a Comment