Continuous Integration in the Cloud

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone

Continuous integration (CI) has become something of a buzzword in the development community over the last few years, and for good reason. It solves problems when they are small instead of waiting till they are well ingrained and are a much bigger issue.

“Never put off till tomorrow what you can do today.”

Thomas Jefferson’s quotes may not have ever been used for programming before, but this one in particular sums up CI quite well: quality control is something that should be done all along the way, saving time, money and effort, while increasing the quality from the standard process of waiting till after the fact to do quality control.

CI is now a common, and accepted/expected, practice for development teams. It helps to identify issues along the way, via a well established and automated process, so that there is a constant “error check” and run process in place. This approach is particularly useful for large projects, involving large numbers of developers.

Popular CI tool: Hudson

Hudson is one of the most popular CI tools due to its ease of use and broad extensibility via more then 250 plugins. It is used by eBay, LinkedIn, Hewlett-Packard, MySQL, JBoss, Xerox, Yahoo and many others. Hudson CI server automates monitoring changes in version control systems, running of new builds, build testing, deploying to application servers and more.

In the short introduction below we’ll show you how to use CI with Hudson for applications deployed on the Jelastic cloud.

1. Create an environment in Jelastic and deploy the Hudson server there. You can find a detailed tutorial on how to do this here.

2. Modify configuration files: settings.xml and pom.xml of your project to include the Maven plugin for Jelastic. This allows you to deploy your application to the Cloud, automatically.

  • Add the Profile tag to your settings.xml file as shown below:
                <jelastic.username>[insert your Jelastic username]</jelastic.username>
                <jelastic.password>[insert your Jelastic password]</jelastic.password>
  • Add Plugin Repository to your project pom.xml :
  • Add to your pom.xml file the dependency section:
<!-- ... -->
     <context><!-- insert your context path or ROOT for default --></context>
     <environment><!-- insert your environment name --></environment>
     <api_hoster><!-- default value "" --></api_hoster>
<!-- ... -->

Insert in <api_hoster> tag API depending on your hoster. You can find the necessary API in the Hosters Info document.

3. Open Hudson in a web browser. Navigate to the Manage Hudson tab and ask Hudson to install Maven automatically. Specify Maven’s name and choose its version.

Don’t forget to save the changes!

4. Create a New Job. Enter job name, select Build a Maven 2/3 project (Legasy) and click ok.

5. On the job Configuration page, in the Source Code Management section, choose Subversion and enter your repository URL.

Then select Poll SCM in the Build Triggers section and set the time period for polling. Hudson will poll your system regularly for changes, e.g. every minute.

In the Build section specify the Root pom (pom.xml). Then type clean install jelastic:deploy in the Goals and option field to deploy your application automatically.

Click on Save at the bottom of the page.

6. Click on the Build Now in the left sidebar. After that click on the progress bar to open the console view and you can follow the progress.

In just a few minutes, your project will be successfully built.

Once the build process has been finished, you can navigate to the target folder of your job to ensure that the war file has been created.

7. Go to the Jelastic dashboard and you’ll see that you app has been deployed to the context you specified in pom.xml.

8. Now, if you make some corrections or changes to your project, after commit, Hudson indicates those changes and automatically builds and deploys the updated application to Jelastic.

We hope this post was useful and informative for you. Please let us know.

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone


Leave a Reply

Subscribe to get the latest updates