Build Test and Deploy using industry standard Jenkins on Express

The latest OpenShift Express release introduces Jenkins to provide continuous integration capabilities for all application types (Java, Python, PHP, Ruby, Perl, and any future language/framework).  Although Jenkins has its roots in the Java world, developers working in other languages often use it to provide an automation framework for software testing.  Check out the Jenkins site for more information.   I’d like to have your attention for a few minutes as I describe what you can do with the Jenkins support baked in to Express applications.

Spoiler alert — there is a video that accompanies this blog post at the bottom that will help you visualize walking through the steps outlined below.

In a previous life I was responsible for QA and Release Engineering for a project made up of as many as 10 developers at a time.  Throughout the course of a day there might have been as little as 5 commits to the source code repository or as many as a few dozen.  Continuous integration, specifically Jenkins, was an invaluable tool as since it provided not only a way to build the software project but also a mechanism for kicking off unit tests, integration tests, regression tests, and functional tests.  We were able to even go as far as setting up Selenium (web browser automation) to execute through Jenkins to provide cross browser cross platform automated web application testing.  The end result was a one stop shop for accessing software build and test results.  The OpenShift team uses many of these same methods for developing and testing the PaaS you love.

By now you’re probably thinking to yourself “ok Dave, I get it – Jenkins support in OpenShift is sweet – stop talking about it and show it to me!” so without further interruption here’s the step by step:

In this howto I’m going to create a javatest application and use the seam-booking example from Github to show off how you can do some cool things with Jenkins on Express

Step 1
Create a jbossas-7.0 application on Express:
rhc-create-app -a javatest -t jbossas-7.0 –enable-jenkins
note: to enable Jenkins on existing applications you can run:
rhc-create-app -a jenkins -t jenkins-1.4
rhc-ctl-app -a myapp -e add-jenkins-client-1.4

Step 2
Make a note of the admin account password for Jenkins and point your browser at http://jenkins-[yourdomain]  You can click ‘log in’ in the top right of the Jenkins window.

Step 3
Add the seam-booking example to our javatest application and push to

git remote add upstream -m master git://
git pull -s recursive -X theirs upstream master
git push

Step 4
The git push that we executed in step 3 above triggers your Express application to update the deployed application to the latest version containing the new changes.  The pre-Jenkins way of doing this was to fire off a command line build and dump the output to the screen.  You will notice now however that a URL is printed on the screen that you can go view for information and status about the build.

Using Jenkins to build/test applications is a two-step process after the ‘git push’ is issued. The first step is to schedule a build of the app.  This involves spinning up a temporary Express application to act as the ‘builder’.  Once this application has been created, the build command is executed and you can watch the build live in Jenkins (under ‘Build History’ select the running build and go to ‘Console Output’).  The great thing about using Jenkins to do your application builds is that you can always come back to Jenkins anytime and view the history.  On each subsequent code change, commit, and push your application will be built using Jenkins.

Thanks for tuning in!

Comments are closed.