Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Tuesday, May 3, 2011

Continuous Integration for ADF applications using Hudson

This post is to show how to create a new job in hudson to setup continuous integration for an ADF application source controlled using svn and hosted on a standalone weblogic server.

Installation of hudson is very simple. Just download the latest version war file from http://hudson-ci.org/ and drop this war in your favorite server container. I am using Tomcat 7 currently.

For this blog post I am assuming following things:

  • You already have a standalone weblogic server setup and capable to run a ADF application.
  • You have the source code of your application version controlled using svn.
  • You have a running hudson with administrator privileges
So, here are the detailed steps to create and configure a job in hudson which will pull the source code from the svn repository when there are any changes committed to it and build n deploy the same code to the running standalone wls.

From the hudson dashboard click on New Job link



On next screen choose the first option free style software project for our job  and give a suitable name the job as shown below

On pressing ok will take you to detailed configuration of the job. This is a big page with a lot of options. So, I am giving a walk-through section via section. In the first part, fill job description and click on 'Discard old builds' checkbox. Here, you can specify how many old builds you want to keep to save the server space as shown below:

You can leave rest of the options and can explore on your own as they are self explanatory. Move down to the 'Source Code Management' section where we will configure the adf source code to pull and build it to deploy.

On choosing subversion, section will expand and ask for repository url which it will check for the validity. Rest of the options can be left default as they are good to go. In the next section, you need to configure at what frequency the builds should happen. Two typical options are polling svn and building periodically. You can choose both for the same job and it totally depends on individual's need. I have below used scm poll which will check for changes in the repository every 5 min.

Other schedules can be configured similarly and well explained in the question mark on the top right corner of the schedule box. So till here, your job is ready to pull the code from svn repo as soon as new changes are there. After this, next steps is to write a small script to build a ear from this code and then deploy it to the running standalone server.  For this click on the list in the build section and choose 'Execute Shell' option. This will provide a text box to write a shell script. You can either write the script here itself or write on the machine where hudson is running and just provide the path here like: /home/username/buildScript.sh as shown below:


I am providing the complete script which can be used to build the ear and deploy it to the running standalone wls with just replacing repo, server urls etc here. Just copy paste it to above text box or store it as a script in your machine and provide the path. Finally there are some post build steps which are like sending email notifications, publishing results etc. Hudson provides a large array of plugins to use for this purpose.







Post a Comment