Continuous Integration in the Cloud, Part II: Jenkins

By July 25, 2012 HowTo 2 Comments
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone

cloud continuous integrationWe have already provided you with the tutorial on how to work with Hudson in Jelastic. You probably know that Hudson and Jenkins are built on the same base tools but these are different projects at the same time. So we decided to prepare one more detailed instruction for Jenkins CI tool fans. But at first we have to understand what Jenkins is and the main differences between Jenkins and Hudson.

Jenkins is the application that monitors executions of repeated jobs, such as building a software project or jobs run by cron. It focuses on the following two jobs:

  • Building/testing software projects continuously, Jenkins provides an easy-to-use continuous integration system, making it easier for developers to integrate changes to the project, and making it easier for users to obtain a fresh build. The automated continuous build increases the productivity.
  • Monitoring executions of externally-run jobs, such as cron jobs and procmail jobs, even those that are run on a remote machine. For example, with cron, you receive only regular e-mails that capture the output, and it is up to you to look at them diligently and notice when it broke. Jenkins keeps those outputs and makes it easy for you to notice when something is wrong.

Jenkins is a new Hudson. One of the unique features of Jenkins is weekly schedule of releases. New features, new plugins (about 350 plugins, here is a list) and bug fixes come out weekly, and the turn-around time for bug fixes can be very short indeed. If you prefer more stability, there are always a stable release approximately every 3 months.

Let’s get started now!

Create an environment

1. Go to and sign up if you haven’t done so yet, or log in with your Jelastic credentials by clicking the Sign In link on the page.

2. While in Jelastic dashboard, click the Create environment button at the top left:

continuous integration cloud3. In the Environment Topology dialog, pick your application server (for example, Tomcat 6). Then type your environment name, for example, jenkins.

continuous integration in the cloud

Wait just a minute for your environment to be created.

jenkins in the cloud

Upload a Java package

1. Go to and download the latest version of Jenkins.war file.

jenkins hosting

2. Go back to Jelastic dashboard, click the Upload button in middle left of the screen, browse the WAR package and click the Upload button.

jenkins package

3. Once the upload is over, click the Deploy to… button next to the package in the Deployment manager, and pick your environment as the target.

host jenkins

4. You can then optionally create a context for the deployment (you would do that if you want to run multiple applications on one server – each would get a subURL based on the context you specify – e.g., just leave it as ROOT if you don’t need subURLs.

jenkins tutorial

5. Once the deployment is finished you can click the Open in browser button for the environment.


Now you can use Jenkins with all its functionality.

continuous integration

Continuous Integration

1. 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.

2. Navigate to the Manage Jenkins tab, click on Configure system and ask Jenkins to install Maven automatically. Specify Maven’s name and choose its version.

jenkins continuous integration

Don’t forget to save the changes!

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

cloud continuous integration

4. 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. Jenkins 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.

jenkins monitoring

5. 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.

Jenkins CI tool

In just a few minutes, your project will be successfully built. Once the build process has been finished, you can navigate to your job to ensure that the war file has been created.

deploy jenkins

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

jenkins config

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

Here is also a video version of the deployment procedure:

That’s all for today! Please let us know what tool you prefer to use Jenkins or Hudson in the comments to this post.

Related articles

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


Leave a Reply

Subscribe to get the latest updates