Hudson is a killer application…

In short: we are building a GWT application (with maven, now using the recently released codehause plugin) that gets integrated into Jira as a Jira plugin. At the end of a successfull build (several artifacts with some ugly maven magic happening) we do shutdown the integration server (a Jira standalone Tomcat install), install the new plugin and start the server again.

It took some time to set it up, it worked, but we where facing some problems…

So I spent a few hours migrating some parts of the build infrastructure:

  • We where using Atlassian Bamboo, now we are using Hudson.
    Bamboo still doesn’t identify maven dependencies, Hudson does.
  • We where using Artifactory, now we switched to Nexus.
    Nexus is not eating up our server ressources.
  • We switched to the new GWT maven plugin.
    First step to switch over to GWT 1.6.

After seting up Nexus, configuring the repositories, setting up Hudson and configuring the projects to build (argh, I can’t use variables in the project configuration) I tried to setup the automatic deployment into our Jira integration server.

Deploying into Jira is really simple: I have a script that shuts down the server, copies the jars and then starts the server again. It worked nice in Bamboo, and there was no obvious reason why it shouldn’t work in Hudson as well. I could simply reload the app, but we know that sooner or later I will have to restart Tomcat – so I prefer to restart on each deployment.

Well, it didn’t work. The newly started server process always got immediately HUPed by Hudson. It is not a bug, it is a feature: it is the ProcessTreeKiller. It identifies the processes spawned by my shell script and cleans up. It is really a great feature, so I won’t have processes left running on my server if a build gets interrupted by Hudson. But in my case I wanted the Tomcat/ Jira process to survive the build.

Well, fortunately you can turn this feature off. Either completely or just for some shell script you are executing.

To turn it off you can use a property when starting Hudson as follows:

To switch it off for just one of your shell scripts you can trick the ProcessTreeKiller by renaming the environment variable as follows:

For now we are happy.
GWT 1.6, here we go!