Showing posts with label subversion. Show all posts
Showing posts with label subversion. Show all posts

Friday, June 20, 2014

Test subversion project using jenkins

In our last article, we learned basic of jenkins. If you do not know what is jenkins and how to install it, please read the article before continue on this. Today, we will learned by configured a project to be test by jenkins.

This article will focus using subversion. If you store code in git, jenkins support it too but you need to install git plugin for jenkins. The installation process is a few clicks only.

To configure the project to jenkins, point your browser to the jenkins server. The click on 'New Item'. This article continue with the first option 'Build a free-style software project' and as for the Item name, you can basically name after your project but if you have specific scope of test, you can also name it as such. The click next and browser is redirected to another page similar to the one below.

I will explain using the screenshot above. For obvious reason, I have to obfuscate certain part of image to protect party interest but you should get the idea easily. With field Description, you can fill additional information here. First four options, you can play around for it but for this simple project, I don't see the need for it. For field Advanced Project Options, you will most likely to start to use it once you get better understanding of jenkins. So we leave those untick as well.

Next, field Source Code Management, this is where you need to select your code repository. As mentioned earlier, we will select the radio button for Subversion. Field Repository URL must be fill it as you tell jenkins where to get your code from. Most likely you code is security protected and hence you should also provide access credential for jenkins to retrieve project codebase. For field Check-out Strategy, you can choose the strategy you like, for me, I just goes for Use 'svn update' as much as possible because there is no point to checkout everything everytime to build project.

So in order to trigger this project within jenkins, you can specify how you want to trigger it. You can also specified by ticking a few options you want to trigger the build process. For me, I like to trigger manually when I want to quickly test my project. Also, I have setup a periodic build that every friday evening at 11pm, the build will be kickstarted automatically.

Normally target is test, but it should be easily understandable if you develop using ant before. This is the target where jenkins will execute. So for your project, open up ant build file and check out the test target. I recommend you click on Advanced... button to see additional configurations which you might need to change. If you ant build file is on the same directory as you configured in Repository URL just now, then you will not need to modify. If you have special configurations which you need to feed into ant build file during jenkins build, specify in properties.

Last step, Post-build Actions, Click on the drop down button Add post-build action, you can add as many action you want but as a starter, a simple email notification would be suffice. That's it and remember to click Save button to save all your configuration!

Go to the dashboard, you should see now your project configured, in the content page, for your project, you click on a drop down button and select Build now, jenkins would check out your project and execute the test target. If you click on the project, you should be able to see the build history on the left menu. This should get you started and by now, you should get a feel on where to go further, so on the left menu, click on Configure and alter advanced configuration and see how it goes!

That's it for this article, I hope you like it.