Tuesday, 10 April 2012

Continuous Integration for SQL Tasks

One of my favourite integration tools is hudson.   Today, we're going to show you how to setup hudson on the Oracle Developer Day image.  Since the image is built on Enterprise Linux, we'll need to either add a yum repository from which to install, or, even easier, just download the RPM from the hudson site
Clicking on the Oracle Linux link, we'll download hudson-redhat-2.2.0.rpm.
When its downloaded, you can install it on your linux image.
Now, its installed, we need to configure it.  Since we put in the RPM, there are a couple of standard directories to check.  Firstly, we have an init.d script for starting and stopping hudson
So, to configure hudson, the actual configuration file is under /etc/sysconfig.
At this point, the main thing we want to do is to configure the port that hudson will operate on.  We'll change ours to 8888, since the image has several other ports doing different things.

Now, once thats done, come back to /etc/init.d and run hudson start.


So now, fireup firefox on the image and punch in localhost:8888


Which will give us this.


 Tada!.  now we have hudson up and running.  Lets run a dumb job to see what happens,  I'll do something really simple so you can try this immediately.
ls -altr
touch barry.txt
echo "Something $BUILD_NUMBER" >> barry.txt
cat barry.txt


creating a new job on hudson is easy.  Click on the new job icon and enter the name and description of your job.


Scroll down and choose a build option of Shell script.
And now add our little script.


and click save at the bottom.  Job done, so to speak.
Now run the job and see what happens.  It will queue it up and run it and when its finished, will show an icon as to whether there is thunder coming or the sun is still shining.
Drilling into the job, you can click on the console output to see how the job actually ran.  
There it is running.  One last step.  We need to add a port forwarding rule to the image so we can check this out from outside the image. and we're done. 


 I've just noticed too, that apex seems to be configured with port 8888, so we could get a clash later.  I will change that on this image.  Anyways, have fun with this for now.  I'll come back to this when we get subversion setup and linked to this so we can checkout the sql/plsql and run tests using this hudson install.

No comments: