Note: migrate an existing job from Jenkins server a to another Jenkins server B. Method: You can copy or move build jobs between instances of projects simply enough by copying or moving thebuild job directories to the new Jenkins instance.
The procedure is as follows:
1. Check the directory where Jenkins jobs are stored.Log on to Jenkins as an administrator and click "System Management/system settings" to confirm the working directory of Jenkins. In this example, the working directory of Jenkins A is/home/. Jenkins, and the working directory of Jenkins B is/root/. Jenkins.
2. Next, migrate the jobs directory.Log on to the Jenkins a server, go to the working directory, compress the jobs directory, and copy it to B:
cd /home/.jenkins
tar -czvf jobs.tar.gz jobs
scp -f jobs.tar [email protected]:/root/.jenkins/
3. Press jobs.tar to the jobs directory on B and restart Jenkins server B. Note: restarting is not required.1) Restart Hudson to load the new migration job:
cd /root/.jenkins
tar -zxvf jobs.tar
In this example, Jenkins is restarted by restarting the Tomcat service, and other restart processes that run Jenkins through jar can be restarted.
cd /opt/tomcat/tomcat7/bin/
./shutdown.sh
./startup.sh
2) No need to restart: Just go to the manage Jenkins screen and click on reload configuration fromdisk. This will load the new jobs and make them immediately visible on the Jenkins dashboard.
Click the "read Settings" button in the above red box to display the following information:
4. Finally, verify whether the migrated new job has been loaded on B and configure the job.1) After logging on to Jenkins B, we found that jobs on a have been correctly migrated in. As follows:
5. Notes1) modify the job configuration: because the previous job configuration is executed on a node of Jenkins A, if you want to run it on a node of Jenkins B, check the job configuration "restrict where this project can be run" and set the node where the job runs.
2) Plug-In: If Jenkins A has installed the plug-in, but B does not, the migrated task may also need to install the plug-in on. There are a few gotchas, however. if you are migrating your jobs to a brand new Jenkins configuration, remember to install, or migrate, the Plugins from your original server. the plugins can be found inthe Plugins directory, so you can simply copy everything from this directory to the correspondingdirectory in your new instance.
From Weizhi note (wiz)