I wanted to set up another windows remote server as my jenkins server , therefore moving all the jobs from our incumbent windows server to the new server was necessary
there are several approaches this can be done
- using thin backup plugin
- just by moving the jenkins folder from one server to the correct location in the other (copying the JENKINS_HOME)
- can use job import plugin if the 2 servers are in the same netowork
lets look at the first appraoch
using the thinbackup plugin
first you will have to install this plugin in both your server
follow the below steps and you will do just fine
- Install ThinBackup on both the source and the target Jenkins servers
- Configure Backup Directory on both (in Manage Jenkins → ThinBackup → Settings)
- On Sourse Jenkins go to ThinBackup → Backup Now
- Copy from Jenkins Source Backup directory to Jenkins Target Backup Directory
- On Target Jenkins go to ThinBackup → Restore, and then restart Jenkins service.
- If some Plugins or Jobs are missing, copy the backup content directly to the target JENKINS_HOME.
- If you had user authentication on the source Jenkins, and now locked out on the target Jenkins, then edit Jenkins config.xml, set
<useSecurity>
to false, and restart Jenkins.
METHOD 2 (copying JENKINS_HOME)
if the jenkins_home is too big you will have to try a diffferent approach
my windows servers were ec2 instances
so i had the luxury of creating a snapshot of the EBS volume of the current server and attach a volume made of that snapshot to my new server
so i had the jenkins_home copied without any problem
in the server go to environment varibles and add the location to your jenkins folder as (root) JENKINS_HOME
then the server will load all the jobs inside it
if the jenkins_home is small you can just zip it upload it to your google drive from the current server and download it back from the new server and place it in the correct place.still you have to add the correct location in env variables
METHOD 3 (job imports plugin)
install this plugin
then this will appear in the dashboard
on the left side , open the plugin
add the URL to the other server and the folders (jobs) it should fetch
the new server will fetch the specified jobs from the old server or infact all.