Move Jenkins jobs from old server to new server

Follow the below steps to move the Jenkins jobs from one server to an another server.

1. Download the jenkins-cli.jar from your Jenkins server(http://JENKINS.SERVER/jnlpJars/jenkins-cli.jar)

2. Then run the below command to get the job configuration and then move it to a config file. Make sure to update the SERVER NAME, JOB_NAME, USERNAME, PASSWORD accordingly


java -jar jenkins-cli.jar -s http://OLD.JENKINS.SERVER.NAME get-job JOB_NAME --username USERNAME --password PASSWORD > JOB_NAME.xml


3. Finally, run the below command to create the job on the new server.Make sure to update the SERVER NAME, JOB_NAME, USERNAME, PASSWORD accordingly


java -jar jenkins-cli.jar -s http://NEW.JENKINS.SERVER.NAME create-job JOB_NAME --
username USERNAME --password PASSWORD < JOB_NAME.xml

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s