How to import local jobs to your new DEV@Cloud instance

Issue

We have jenkins locally and would like to import the configuration into CloudBees, is there a way to do that? Or we will have to start to configure each projects again on cloudbees?

Environment

DEV@cloud

Resolution

If you are in the process of migrating your Jenkins instance to our DEV@cloud service, you may want to import your ancient job to simplify the migration process.

To do so, you can either:

  • use the Job Import Plugin. Note that it requires that the ancient instance is accessible from the DEV@cloud platform. If it’s not the case, you can use the second option
  • duplicate job configuration with the Jenkins CLI

Please keep in mind that some configuration in your ancient jobs will have to be modified in order to work on DEV@cloud. To mass correct the biggest quirks, like JDK or Maven tooling configuration, you can use the Configuration Slicing Plugin.

Migrate jobs with the Jenkins CLI

Jenkins CLI is distributed inside jenkins.war as a jar file. See http://yourserver.com/cli for where to download the CLI jar file. In theory, the CLI jar is dependent on the version of Jenkins, but in practice, we expect to be able to retain compatibility between different versions of Jenkins.

Given that you have downloaded jenkins-cli.jar, you can launch theses commands in a terminal to duplicate a job from your old instance to your new one.

java -jar jenkins-cli.jar -s http://YOUR-OLD-SERVER get-job JOBNAME > myjob.xml java -jar jenkins-cli.jar -s http://yourdomain.ci.cloudbees.com NEW_JOBNAME < myjob.xml

You must setup a ssh key in your GrandCentral account to authenticate yourself. If the key you want to use is not ~/.ssh/id_rsa or ~/.ssh/id_dsa, then you must add the -i option and give the path of your private key. Note the SSH key must be an openssh key.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.