Moving from one Jenkins instance to a fresh one (preserving configuration)

Reading time: 2 minutes

Back to the Blog posts

At my current project (.NET web application with Microsoft SQL Server) I am responsible for configuration management. For some time now we were using Jenkins for continuous integration and also for deployment of our test environments. Basically we had the following setup:

Every of the above mentioned machines (Jenkins03 is just a VM) is based on Windows Server 2008 with .NET 4.0 installed. For an upcoming release we planned to upgrade our application to run on .NET 4.5, SQL Server 2012 and Windows Server 2012. As .NET 4.5 is a replacement of .NET 4.0 it’s kind of problematic when developing older releases (.NET 4.0) and future releases (.NET 4.5) in parallel. Because .NET 4.5 replaces version 4.0 we cannot make sure that everything works as expected when we upgrade all environments to 4.5 and build the older releases. We are therefore forced to strictly isolate the environments. That leads us to the following constellation:

I’ve gone the following path to install a fresh Jenkins instance while preserving the configs:

cp -r X:/Jenkins/jobs/T02*/*.xml C:/ --parents

As you can see most of the work went pretty straightforward. Simply copying all .xml files and just reloading the config has saved us many manual steps. The only thing we had to do manually was to rewire all the downstream jobs.