Migrate jobs to a different server

I have a Jenkins instance with freestyle projects. I have a new Jenkins instance where I need to clone few of the existing jobs in the old Jenkins server to the new one.

What is the best way of achieving this?

There is the Job Import Plugin that might help. Otherwise, it will depend on if you want to maintain the history of the jobs or not. If you do not, you can create the directories in JENKINS_HOME on the new server in a similar layout to the old server and copy the config.xml for the job over to the new server. If you do want to maintain history, you should be able to copy the full jobs directory over to the new server from the old. I would recommend using copy instead of move so you have the original server continuing to function until the new server is tested and ready to go.

1 Like

How can I efficiently migrate specific Jenkins jobs, including their configurations and dependencies, to a new Jenkins server using code, while preserving the existing Jenkins environment on the old server?

My main motto, is to create a script in which i can just run required jobs and it gets exported on to the new server with credentials and secrets!