Programmers' quotations about programming languages and IT

Migrating Hudson build jobs from one server to another

Monday Mar 15, 2010


Tags Java

Sometimes, you may need to move or copy Hudson build jobs from one Hudson instance to another, without copying the entire Hudson configuration. For example, you might be migrating your build jobs to a Hudson instance on a brand new box, with system configuration details that vary from the original machine.

Hudson stores all of the data it needs for a project in a sub-directory of the ‘jobs’ directory in $HUDSON_HOME. This sub-directory is easy to identify - it has the same name as your project. Incidently, this is one reason why your project names really shouldn’t contain spaces, particularly if Hudson is running under Unix or Linux - it makes maintenance and admin tasks a lot easier if the project names are also well-behaved unix filenames.

You can copy or move build jobs between instances of projects simply enough by copying or moving the build job directories to the ‘jobs’ directory on the new Hudson instance. A project job directory is self-contained - it contains both the full project configuration and all the build history. It is even safe to copy build job directories to a running Hudson instance, though if you are also deleting them from the original server, you should shut this one down first. You don’t even need to restart the new Hudson instance to see the results of your import - just go to the ‘Manage Hudson’ screen and click on ‘Reload Configuration From Disk’. This will load the new jobs and make them immediately visible on the Hudson dashboard.

There are a few gotchas, however. If you are migrating your jobs to a brand new Hudson configuration, remember to install, or migrate, the plugins from your original server. The plugins can be found in the $HUDSON_HOME/plugins directory, so you can simply copy everything from this directory to the corresponding directory in your new instance.

Of course, you might be migrating the build jobs to a new instance precisely because the plugin configuration on the original box is a mess. Hudson plugins can be a bit buggy sometimes, and you may want to move to a clean installation with a well-known, well-defined set of vetted plugins. In this case, you may need to rework some of your project configurations once they have been imported.

The reason for this is straightforward. When you use a plugin in a project, the project’s config.xml will be updated with plugin-specific configuration fields. If for some reason you need to migrate projects selectively to a Hudson installation without these plugins installed, Hudson will no longer understand these parts of the project configuration. The same thing can also sometimes happen if the plugin versions are very different on the machines, and the data format used by the plugin has changed.

If you are migrating jobs to a Hudson instance with a different configuration, it also pays to keep an eye on the system logs. Invalid plugin configurations will usually through warnings or exceptions. While not always fatal, these error messages often mean that the plugin will not work as expected, or at all.

Hudson provides some useful features to help you migrate your project configurations. If Hudson finds data that it thinks is out of date or invalid, it will tell you so. On the ‘Manage Hudson’ screen, you will get a message like the one below:

From here, you can choose to either leave the configuration as it is (just in case you roll back to a previous version of your Hudson instance, for example), or let Hudson discard the fields it cannot read. If you click on the ‘Manage’ button, Hudson will bring up a screen containing more details about the error, and can even help tidy up your project configuration files if you wish:

This screen gives you more details about the project containing the dodgy data, as well as the exact error message. This gives you several options. If you are sure that you no longer need the plugin that originally created the data, you can safely remove the redundant fields by clicking on the ‘Discard Unreadable Data’ button. Alternatively, you may decide that the fields belong to a useful plugin that hasn’t yet been installed on the new Hudson instance. In this case, install the plugin and all should be well. Finally, you can always choose to leave the redundant data and live with the error message, at least until you are sure that you won’t need to migrate the job back to the old server some day.

So, all in all, migrating build jobs between Hudson instances isn’t all that hard - you just need to know a couple of tricks for the corner cases, and if you know where to look Hudson provides some nice tools to make the process smoother.

VN:F [1.0.9_379]
Rating: 0.0/5 (0 votes cast)

Upcoming Java Power Tools Bootcamps in Canberra and Sydney, Wellington, London and Paris - Don’t miss out!

Friday Nov 27, 2009


Tags Java

new
All true craftsmen need the best tools

There are still a few places available on the Canberra, Brisbane, Sydney and Wellington sessions of the Java Power Tools bootcamps. Come see what the buzz is about!

And, after a very popular session in London in July, we are working with SkillsMatter to plan next years European schedule. Sessions are already scheduled for Paris and London in February next year.

There are lots of tools, techniques and practices that you can use to speed up your development process, at all levels. But sometimes it’s hard to know what tools exist, or how best to use them. And it can be frustrating and slow going if you have to discover all the tips yourself.

These bootcamps are a great way to improve your development skills across the board no matter what Java technologies you use. Made up of a seris of in-depth tutorials on development tools and practices right across the development life cycle, we go from build scripting and build automation, unit, integration and functional testing, right through to automated deployment. The course is above all pragmatic: at each stage, we look at how you can speed up your development using the latest in Java tools and best practices.

We look at how to use Maven to streamline and standardize your development process, and waste less time with low-level build scripting, and let you take your builds to the next level of productivity.

We also study code quality metrics and code coverage tools such as Checkstyle, PMD, Findbugs and Sonar, and look at the best ways to use these tools to improve your code and train your team. We look at a range of testing tools and techniques, including the latest JUnit 4 features, and other testing tools such as SoapUI, Selenium, easyb, infinitest and testing with Groovy.

We also look at the broader picture: learn how to automate deployment with Cargo, and how to use Continuous Integration, using Hudson and Nexus to bind the whole development and deployment process together, acting as a communications hub for your development team and automating everything from snapshot builds to staging and production releases.

I’ve been getting very positive feedback about the course, both from newer developers and from more experienced ones. I got several comments along the lines of “One of the best and most useful courses I have attended”. Many developers appreciate the global view they get of current Java Best Practices: “This was a great all round introduction to best practices for development process optimization. I found all of the content very helpful and easy to understand.. Others liked the global picture, and the way the course covers not only what tools exist, but when they are appropriate: “Gives a very good overall view of the Java development environment. Not just how to write Java code but the ‘business end’ - how to build, test, deploy, manage and monitor.”

We also offer generous group and public service discounts. So what are you waiting for? Sign up today!

VN:F [1.0.9_379]
Rating: 5.0/5 (1 vote cast)

>