How can I copy jobs and folders from one instance to another?

Article ID:213113377
1 minute readKnowledge base

Issue

I’m trying to move folders from one instance to another (i.e. my "Prod" environment to my "Test" environment. I can’t find a way to do that.

Environment

  • CloudBees Jenkins Enterprise

Resolution

Folders can be moved within one instance using the 'Folders' and 'Folders Plus' plugins, however there isn’t a plugin or built-in method to move folders and/or jobs between two Jenkins instances. A Jenkins "folder" shows up as a folder in the filesystem (underneath the $JENKINS_HOME/jobs - for folders at the root level). Each folder has its own "jobs" subdirectory, and nested folders will appear underneath that in the filesystem. That being said, you can copy Jenkins folder structures (and their corresponding jobs) by simply doing a recursive copy/paste from the origin instance to the destination instance. Following the recursive copy, it may be necessary to restart the destination Jenkins instance in order for the folders and jobs to appear.

It is critical to validate that the destination Jenkins instance is running exactly the same set of plugins as the source one. In addition, you should copy credentials, secrets, keys, global tools, artifacts, etc. which are required by the projects you plan to migrate.

Move/Copy/Promote

When you manually copy the folders from the source to destination Jenkins instance, you risk to face failing builds due to missing or uncompatible plugins, missing credentials, global tools, secrets, etc. To prevent such an unfortunate experience, we recommend to use Move/Copy/Promote feature, which is explained in CloudBees Jenkins Operations Center administration guide.