You can test to see if this has a hope of working by doing the following: 1) check to see if the CLI works:
java -jar jenkins-cli.jar -s JENKINS_URL who-am-i --username=YOUR_USERNAME --password=YOUR_PASSWORD Replace YOUR_USERNAME and YOUR_PASSWORD as appropriate. 2) If that works and doesn't give you exceptions, you can run something like the following: java -jar jenkins-cli.jar -s JENKINS_URL list-jobs --username=YOUR_USERNAME --password=YOUR_PASSWORD This should give you a list of jobs. Replace "list-jobs" with "get-job SOME_TEST_NAME" and it will spit out a pile of XML at you. 3) Doing the transfer If all that works, and assuming you have access to create jobs on new jenkins server, and that server has all the needed plugins/prerequisites. You can use the following script: Edit the 4 variables at the top as appropriate (this assumes Mac, or some other unix) Disclaimer, use at your own risk, of course. I don't know your environment. I did something similar to this in order to migrate from a windows master to a linux master (I modified the xml files for my own needs). #!/bin/bash OLD_JENKINS_URL=http://oldjenkins.somedomain.com NEW_JENKINS_URL=http://newjenkins.otherdomain.com YOUR_USERNAME='replace_here_with_username' YOUR_PASSWORD='replace_here_with_password' WORKDIR="/tmp/transfer.$$" mkdir -p $WORKDIR java -jar jenkins-cli.jar -s $OLD_JENKINS_URL list-jobs --username "$YOUR_USERNAME" --password "$YOUR_PASSWORD" > testlist.txt for job in `cat testlist.txt` ; do echo Copying job $job java -jar jenkins-cli.jar -s $OLD_JENKINS_URL get-job $job --username "$YOUR_USERNAME" --password "$YOUR_PASSWORD" > $WORKDIR/$job.xml java -jar jenkins-cli.jar -s $NEW_JENKINS_URL create-job $job --username "$YOUR_USERNAME" --password "$YOUR_PASSWORD" < $WORKDIR/$job.xml done ----- Original Message ----- From: "SamiSam" <[email protected]> To: [email protected] Cc: [email protected] Sent: Friday, February 28, 2014 12:23:28 PM Subject: Re: Best practice to copy Jenkins jobs from old instance to new one - Different networks - No root access to server - Manual Copying preferred oh interesting. I just downloaded jenkins-cli.jar -- a few questions Patricia the first line: java -jar jenkins-cli.jar -s https://oldjenkins.yourdomain.com login - will the login be user:password ? if so, nothing happens on my end. Should i copy and modify your instructions into a file and execute? Sorry, I'm not a developer but an Integrator. Thank you On Friday, February 28, 2014 11:50:40 AM UTC-5, Patricia Wright wrote: Just so I am clear, I'm not referring to the cli of the jenkins server itself. The CLI I refer to is the remote jenkins command line. You can download the .jar file from $JENKINS_URL/jnlpJars/jenkins-cli.jar and run it on any machine. From: "SamiSam" < [email protected] > To: [email protected] Sent: Friday, February 28, 2014 11:45:44 AM Subject: Re: Best practice to copy Jenkins jobs from old instance to new one - Different networks - No root access to server - Manual Copying preferred Thanks for the suggestion Patricia.. Unfortunately, no access to CLI.. I could have easily copied the directory where the jobs reside in and call it a day.. but that's no an option. sigh On Friday, February 28, 2014 9:56:42 AM UTC-5, SamiSam wrote: <blockquote> Hi there, Can someone recommend a way to copy Jenkins jobs from an old server to a new one? Unfortunatley, I don't have root access to the old server, so copying the directories is not an option. Using a plugin might not be an option either. Can this be performed manually? Any help would be greatly appreciated! Thanks in advance -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] . For more options, visit https://groups.google.com/groups/opt_out . </blockquote> -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
