Making Hudson (Jenkins) update it self

A funny thing happens when you start delivering software through an automated system. You need to find a way to upgrade the automated system, and yet it is in use all of a sudden.

Luckily for us we have everything checked into Git!

So we create a job that does a Git pull in the root hudson directory, and the use curl to tell hudson to reload the configuration from disk.

image

Some tweaks to doing this is to create a restart job, and have the update job call that job instead of doing the reload in the same job as the Git pull operation. The reason for this is that the reload doesn’t wait for the job to finish, so the build history starts to lag by one build for the job that does the reload.

Some thoughts on triggers

Having Hudson checked in into GIT gives you a distributed build system. We have our system set up so we have a master CI server that hosts the latest version of our system on github. We can have build triggers set up to update the CI every time we push. However, due to the reload configuration we aren’t doing that instead we ask the system to update it self at specific periods. We don’t want to interrupt current builds to do an update.

Any tips on getting the restart job to wait for all other builds to finish are appreciated.

Next, we use the system for deployment as well. This means that there is a version up and running in our production environment as well. For us the manual updating by running a job works great for the production system, since we do not have to open up access to Hudson in the production environment instead letting the system update itself from github.