Sep 08 2009

Continuous Deployment with Hudson…

Since I was looking through the Hudson plug-in list this week, I decided to try a few more of them. We currently have Hudson continuously deploying a simple web application to a Tomcat instance. Since both Hudson and Tomcat are running on the same server, it was pretty simple to have Tomcat point to the WAR file generated during the build process. Tomcat notices the new WAR file and automatically redeploys the application. Pretty simple and pretty handy; this is about a 100 times easier and faster than dealing with our standard Weblogic deployment process!

So, how do you deploy your application if Hudson is running on a different machine than your Tomcat instance? Fortunately, Hudson provides a plug-in to solve this problem, simply named the Deploy Plug-in. It supports a variety of containers, taking advantage of the Cargo Framework. Can’t get much easier than this, just point to your WAR file and fill in the container information. That’s it! I tried it out today and it worked perfectly. This was a much cleaner approach than adding the logic to the build process.

Having the current code set continuously deployed is a great benefit all by itself. This helps ensure that your application is built correctly and is deployable; How many times have you forgot to add that new JAR file to the WAR, only to discover the failure several days later? Continual deployment also makes the application constantly available to the analysis and test teams. This allows everyone to see the current state of development and bounce through the application to see how it will ultimately work. This early exposure also gives developers a change to resolve issues much earlier in the development cycle. We can achieve more value by adding the integration or system testing to the process as well… Just think how much we could reduce our development and testing cycles with this level of testing?

I have been starting to read about Selenium on the Hudson mailing list and found this interesting blog by Ben Rometsch on “Easy Automated Testing with Hudson and Selenium“. I really liked this picture from the article (hopefully it will spark your interest too!) and truly believe this is what we should be working towards… Maybe this can be one of my next educational adventures!!!

https://www.beilers.com/wp-content/plugins/sociofluid/images/digg_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/reddit_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/dzone_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/delicious_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blinklist_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blogmarks_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/google_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/facebook_48.png


Sep 07 2009

Hudson Plug-in for Custom Documentation, integrating an Ivy Report

Category: Continuous Integration,Software DevelopmentPhil @ 7:14 am

One of the best things about the Hudson Continuous Integration platform, is the amount of activity. People are constantly fixing problems and adding new functionality. I’m sure that some would say this is a bad thing, but even with the frequent releases, it is amazingly stable.

I have been moving projects to the Ivy Dependency Manager for the last couple of years. We have established a multi-repository solution, that allows us to control access to the repositories without impeding the progress of the development teams.  Introducing multiple repositories and transitive dependencies takes a little getting used to, so I have been adding an ivy.report task to each of the project’s build scripts.  Here is an example of Ivy dependency report. I think it is quite handy on multiple levels, but the primary benefit is displaying the dependencies of each component. Side benefits include showing the different types licenses used by each component, kind of nice for corporate environments. The report also shows where the components are resolved from, such as the legacy or sandbox repositories (indicating that you might need to do some promotion or upgrade work before releasing the project).

My problem was, how to tie the Ivy dependency report into my continuous integration process. Building the report was easy, but how could I make it available on the main Hudson project page? Unfortunately, there was no plug-in to make this happen; I was actually thinking about writing my own plug-in this summer, but never quite got around to it (or blogging for that matter!) Fortunately, this appears to have been a common need and someone was nice enough to release a really nice plug-in this past July, called DocLinks. It allows you to add multiple links to items generated by the build process. The process could not be simpler.  The links will automatically show up on your main project page, but will not be active until the next build completes.

This also solved a problem that I have with the Testability Explorer plug-in. I have about a 50% success rate with this plug-in. I am able to generate both the XML and HTML files for all projects without issue, however, the Hudson Plug-in reports nothing for half of the projects; I have yet to figure out the pattern. Anyway, the DocLinks plug-in now lets me add a link to the Testability Explorer HTML report, so that everyone can always see the results, independent of the Hudson integration.

Suggestion!There is one area that the Hudson community could be a little more helpful. The Hudson tool is very good about showing you when updates are available for itself or installed plug-ins. However, there appears to be now good process for discovering new plug-ins. I even follow the Hudson mailing lists, and there are no notices about new or updated components; the only way I know about upgrades is to click the “configure” link every so often, when I actually remember! To find out about new plug-ins is even worse, I have to look at the Plug-in page, and notice if there is something new. There are so many plug-ins now, it is almost impossible to know if something has been added. Hopefully, they will add some kind of search for recently added or updated feature to their page; I’m sure that I’m not the only one that would appreciated it!

https://www.beilers.com/wp-content/plugins/sociofluid/images/digg_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/reddit_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/dzone_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/delicious_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blinklist_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blogmarks_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/google_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/facebook_48.png


Jun 10 2009

Hudson Continuous Integration and Eclipse Update Sites

I was looking for a development build of the IvyDE plug-in for Eclipse tonight and I stumbled across the Apache Hudson server. You have to check this out. Pretty cool, Hudson running over 150 jobs!  Their build farm consist of both Solaris and Ubuntu servers. What I found most interesting was how they used Hudson for creating an Eclipse update site. I subscribe to the Hudson mailing list, summarized here, to follow what is going on with the project. People seem to use Hudson for a variety of different purposes, such as a cross platform testing tool and even as a deployment tool. I have only been able to get people interested in Hudson as a “Cruise Control” replacement…. but at least it is a good start!

This site also demonstrates how multiple projects can be linked together, triggering builds of dependent downstream projects.  I’m not exactly sure how these jobs were assembled, but at a high-level, Ivy and IvyDE each have its own build loop (job). Each job is responsible for creating build artifacts. After a successful build of either job, a third job is triggered which creates/updates and Eclipse update site.  Pretty slick. (As any FYI, the dev plug-in looks better, new presentation and several new new options)

Another small plug for Continuous Integration. We recently set up something kind of cool (trivial, but cool)! As we continue trying to convince the powers that be, to move away from Weblogic towards Tomcat (or even JBoss), we found a really nice little feature. Since Tomcat and JBoss can hot deploy a new version of the WAR file, just by noticing a difference on the file system, combined with the fact that we can spin up a Tomcat instance in about 2 minutes, we actually created an auto deployment mechanism.  Our Weblogic environment seems so cumbersome in comparison…. We could have built the WAR and deployed in in our build loop, but that would have minimally added another 25 minutes to the loop (let’s just say we have an interesting deployment process). With Tomcat, we did a one time deployment to the location of the WAR file inside the Hudson workspace. Now, with each series of check-ins, we build the WAR as normal and Tomcat instantly deploys it, in seconds! If we were a little more sophisticated, we would write some jUnits to bang against it, making sure we did not break anything or create any new dependencies.  Maybe I will throw that in during my next project!!! I know this integration was possible before (with Weblogic), but no way as simple!  Even better Continuous Integration… on my last project I had Ant spin up an embedded Jetty web server, ran my jUnits against the Clover instrumented code, and finally had Ant shut down Jetty…. Pretty slick, from a code coverage collection perspective…

https://www.beilers.com/wp-content/plugins/sociofluid/images/digg_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/reddit_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/dzone_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/delicious_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blinklist_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blogmarks_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/google_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/facebook_48.png


Mar 07 2009

Setup Hudson for Continuous Integration

Category: Continuous IntegrationPhil @ 8:24 pm

I have been experimenting with Hudson for several weeks now and I like the tool much better than Cruise Control. Not to say it does not have its issues, it generally works very really.  I have mostly had issues getting reports to show up in the project. For example, it appears that on a new project, jUnit test results will not show up until after the first completely successfully loop; kind of strange. One issue that is really frustrating me, the Testability Explorer plug-in;  I just can’t seem to get the report integrated, all of the other plug-ins have worked as expected.

There is one big difference between Cruise Control and Hudson, which I have not exactly come to grips with yet: the handling of build errors. Hudson introduces the the concept of Job Stability. Traditionally, I relied on Ant to determine the success or failure of the build, but with Hudson, it is also possible to determine the stability or health. Most plug-ins allow you to provide custom ranges to indicate the job’s stability, based on the number of errors or warnings generated by the component. On most of my projects, we did not allow any PMD or Checkstyle errors, so job stability was never much of an issue. However, there are many projects that allow Checkstyle, PMD, and even jUnit errors; this is where the stability metric can be really helpful. This would also be useful when introducing a new tool into a project and it takes time to cleanup the issues.

I found a very well written article for setting up a Hudson server.  If you are really ambitious, the article walks you through setting up a Tomcat or JBoss installation.  I originally setup Hudson using Tomcat, but most of my experimental work, I have used the built-in Servlet Container; it is a little easier and makes the frequent updates as simple as a mouse click.

https://www.beilers.com/wp-content/plugins/sociofluid/images/digg_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/reddit_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/dzone_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/delicious_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blinklist_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blogmarks_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/google_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/facebook_48.png


Feb 14 2009

The last word on Continuous Integration…

Category: Continuous IntegrationPhil @ 9:22 am

My last rave about Continuous Integration (CI)… I happened to find a really interesting document this week, and I just had to share it… The main point that I wanted to stress is the value of CI. The study was from a very small sample, but the results where in line with my personal views. The document is a very good comparison of twelve different tools and provides a good background on why one would use CI. It is easy to read and contains lots of interesting graphs.

The document is a study of Continuous Integration tools by Fontys University of Applied Sciences in Venlo, Netherlands. This study showed that Cruise Control is still the leader in this space; probably due t o the fact that the Cruise Control has been around for almost 10 years. Hudson, which has only been around for 2 years, appears to be closing in fast on the Cruise Control market share. I found another website that shows Hudson with a significant portion of the CI market. To my surprise, there appears to only be a couple of real contenders, all of the other tools are not well represented.

I also wanted to throw in this last graph to reinforce the dominance of Subversion as a version control system. It has been interesting to watch how fast the open-source community moved away from CVS over the last couple of years. I think it will be very interesting to follow the growth of Git. It has received a lot of press over the past year and seems to create a religious debate when compared with other tools. Just what we need! I was shocked to see the significant projects using Git: Ruby on Rails, Android, Fedora, X.org, just to name a few.

https://www.beilers.com/wp-content/plugins/sociofluid/images/digg_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/reddit_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/dzone_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/delicious_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blinklist_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blogmarks_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/google_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/facebook_48.png


Feb 10 2009

Hudson Overview

Category: Continuous Integration,TestingPhil @ 10:48 pm

I was playing with Hudson today in what I would call a non-standard, maybe non-friendly Linux box. The first time I setup Hudson, Java and Ant were installed in the standard locations; once I configured my projects, Hudson just went to work. On the non-standard box, nothing was installed in the expected locations, fortunately this was no big deal. The Hudson configuration options are simple and numerous.  The system level configuration page has options to configure the JDK, Ant, Maven, Shell, and email settings; which are all specific to the machine that Hudson is installed on.  At first, I thought this might be limiting, as very few projects use the same version of these tools. Luckily, the configuration page has the ability to specify the JAVA_HOME and ANT_HOME for multiple versions of each tool.  This allows each project to specify which version of the tool they want to use in their build process, pretty simple.

One of the more interesting system level configurations addresses Hudson’s security. There are five different security options, from no security to per-project security.  For authentication, I configured Hudson to use an LDAP server. This took a little trial and error, as this feature does not seem to be well documented. Fortunately, it only took a couple of attempts and the login screen started working. I chose to implement project-based security; this allowed me to delegate the responsibility of each user’s role to the project’s owner. This seemed like a good approach for limiting the amount of work required by the Hudson administrator.  There could be simpler configurations, especially if you wanted to manage fewer people, but this approach gave me the finest grain control over each person’s ability… which might actally be overkill is practice. I would really need to see this working on a real  project before I would be able to suggest the best security option, but it would seem to work in multiple environments.

The final step is to create and configure an individual project, which is also very straight forward. First, you pick the version control system and enter the repository and access information. Next, select the Ant-based project option and type in the Ant target name that is responsible for the continuous integration. There are multiple options you can configure here as well, but that is all I needed to start the process. Because Java and Ant were not installed in their normal locations, I selected the appropriate versions, as configured in the system level. That was it. I hit the build button and off it went. Hudson provides all kinds of visual feedback on the dashboard, letting you know exactly what is building, and even predicts how long until the current build finishes. One of the more interesting features is the ability to watch the build from within the dashboard (web page).  Hudson uses AJAX to capture the log file of the running Ant process and shows a live update to the user. Pretty cool, it is no different than running Ant in a local shell!

This tool seems significantly simpler to get working than Cruise Control. I really like that fact that every project can be configured to match its own requirements.  Some projects might want to use Checkstyle and PMD, another project might want to use FindBugs; not a problem. Once the plug-ins are installed by the administrator, Hudson makes them available to each project and automatically published the collected results. Because of this project centric view, it is even easier to integrate with multiple version control systems, each project simply chooses the appropriate back-end.

I did want to mention that Hudson seems to be a tool that extends beyond the typical developer requirements. As I mentioned in a previous post, QA groups can also use Hudson for activities other than continuous integration.  One interesting feature is Hudson’s ability to monitor external jobs. This allows you to record the execution of a process run outside Hudson, even on a remote machine. It was designed so that you can use Hudson as a dashboard of your existing automation system. Hudson even have multi-server scalability built-in. This allows the environment to be configured with helper machines to distribute the processing load, taking advantage of the remote resources, while centrally managing and monitoring the process.

Hudson appears to have been pretty well thought out. Hopefully someday soon, I can use it for real!

https://www.beilers.com/wp-content/plugins/sociofluid/images/digg_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/reddit_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/dzone_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/delicious_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blinklist_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blogmarks_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/google_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/facebook_48.png


Feb 07 2009

Continuous Integration

Category: Continuous IntegrationPhil @ 11:07 am

I embraced continuous integration many years ago for purely selfish reasons, but it did not take long to see the real value of the process.  I happened to work on a team where developers continually forgot to check in all of their work. Being an early morning person, I would be the first one to sync out  the previous days changes; at least once a week, my work area would be unbuildable because of missing files. I would end up wasting time mocking up an object or figuring out how to work around the problem.

Enter Cruise Control. I originally setup the tool for notification purposes, cruise would monitor the CVS repository for changes and kick off the build script after each check in. If the build failed, anyone who made changes since the last successful build will be notified of the failure via email. To ensure that the developers would fix the problem, we enabled the spam feature. Cruise would continue to attempt building the project until it was successful. This could result in numerous email messages per hour, and was usually a pretty good motivator to fix the problem. We actually had to institute a higher level of encouragement on some projects, the “Bagel Rule”. If you were responsible for breaking the build for over 24 hours, you had to bring in bagels for the team. This rule worked wonders!

Once the developers got used to the process, we started to crank up the expectations. We could use Cruise to improve the quality of our code, enabling tools like Checkstyle and PMD.  If the code did not conform to our standards or was overly complex, the build was marked as a failure.  These tools essentially automated a basic code review  process.  They did not guarantee a good design, but did a pretty good job at ensuring that the code was well structured and maintainable.  The most valuable Cruise integration was the addition of jUnit and Clover.  By executing the jUnit suite after each check in, helped us discover any unintended sided effects induced by the changes.  By combining the execution of the jUnit suite with code coverage data (we happened to use Clover), gave us a quantitative value of the confidence that we could place on our code.  If we had low code coverage, it was impossible to have high confidence in our code’s correctness, or even in our ability to refactor the code and ensure that that it still worked. Conversely, if we had a decent quality jUnit suite and a high code coverage percentage, then we felt pretty good about the correctness o the code base and had complete confidence in our ability to refactor.

Cruise Control has been around for quite a few years and is now a very mature tool. This is one of those areas that I have not recently researched, but was surprised by how many options are now available to development teams. Cruise Control is fairly easy to setup and does exactly what it needs to do, from an continuous integration perspective. However, it does not provide that same amount of information and value that other tools appear to provide. From a commercial product perspective, I would really like to evaluate the Bamboo tool from Atlassian. I have been throughly impressed with the Atlassian product suite. I think they really understand what developers need and how they work.  My favorite open source product is Hudson. It seems to have some pretty big supporters, such as JBoss QA (Check out the link, pretty cool).  What makes Hudson interesting is the plug-in infrastructure and the trending aspects. It is very easy to integrate and publish a variety of metrics in the Hudson dashboard, something that Cruise Control does not do very well at all.  The dashboard gives you a good feeling of the projects health and stability. Hudson keeps a history of metrics, and displays how the project has evolved over time. Pretty cool, if you are interesting in continuously improving your code base; it gives the developers a dynamic picture of their effort.  Configurability is probably one of Hudson’s greatest strengths, more on that later.

What are your experiences?  Just like unit testing, I would not want to develop without my continuous integration safety net!

https://www.beilers.com/wp-content/plugins/sociofluid/images/digg_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/reddit_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/dzone_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/delicious_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blinklist_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blogmarks_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/google_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/facebook_48.png


« Previous Page