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!!!
January 9th, 2011 8:14 pm
Are there any downloadable continuous deployment packages?…
Aside from a few Ruby scripts you can find on Github, I don’t know of any publicly released tools for managing the continuous deployment process (real-time dashboard, deploy/monitor/rollback, etc.). Hudson is widely used for continuous integration and…
May 28th, 2012 8:57 am
Hi,
I also planning to use it.
Can you explain how to give WAR/EAR file location. Is there home dir of hudson do matters to it ?
May 28th, 2012 11:04 am
This article was written before I started using Maven as my build tool… (Switch to Maven and don’t look back!) Thus, I always had a convention in my ANT build scripts, to generate everything under a sub-directory called CI. This allowed me to easily add a single ignore directory… If you are a Maven user, it would be equivalent to the the “target” sub-directory. The Jenkins/Hudson plugin was pretty simple to configure – you just give it the path to where you generated the WAR file, that is it! In my example, it was located in the “CI” directory. Good luck!
September 18th, 2012 2:03 am
I built my application using Ant build script and it create WAR in dist directory.
I gave the correct war file location to Hudson, but after Hudson copy it to Tomcat/webapps i saw
size of the war is reduced and it is corrupted. I got exceptions,
ERROR: Publisher hudson.plugins.deploy.DeployPublisher aborted due to exception
org.codehaus.cargo.container.ContainerException: Failed to deploy [C:\Hudson_Home\jobs\MyJob\workspace\MyApplication\dist\MyApplication.war]
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.deploy(AbstractTomcatManagerDeployer.java:109)
at org.codehaus.cargo.container.tomcat.internal.AbstractTomcatManagerDeployer.redeploy(AbstractTomcatManagerDeployer.java:183)
at hudson.plugins.deploy.CargoContainerAdapter.deploy(CargoContainerAdapter.java:62)
at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:92)
at hudson.plugins.deploy.CargoContainerAdapter$1.invoke(CargoContainerAdapter.java:75)
at hudson.FilePath.act(FilePath.java:758)
at hudson.FilePath.act(FilePath.java:740)
at hudson.plugins.deploy.CargoContainerAdapter.redeploy(CargoContainerAdapter.java:75)
at hudson.plugins.deploy.DeployPublisher.perform(DeployPublisher.java:45)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:630)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:608)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:584)
at hudson.model.Build$RunnerImpl.post2(Build.java:159)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:553)
at hudson.model.Run.run(Run.java:1390)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:145)
Caused by: java.net.SocketException: Unexpected end of file from server
Please help me.
Thanks,