Restoring credentials

There are three primary use cases where you may need to move credentials between masters:

  • Cloning a master.

  • Moving jobs from a monolithic master into a smaller Team Master.

  • Migrating from CloudBees Jenkins Enterprise v1 to CloudBees CI.

Managing credentials when cloning a master

You may need to create a test master from the backup of a production master. If you do so, and the masters are in the same cluster, you may receive errors, and should use the following instructions to resolve the problem:

  1. Log into the origin master and stop the master.

  2. Using administrative SSH or console access, log into the master and remove the following files:

    • $JENKINS_HOME/license.xml

    • $JENKINS_HOME/operations-center-cloud*

    • $JENKINS_HOME/operations-center-client*

    • $JENKINS_HOME/com.cloudbees.opscenter.client.plugin.OperationsCenterRootAction.xml

  3. Disable security:

    1. Open $JENKINS_HOME/config.xml.

    2. Locate the line <useSecurity>true</useSecurity> and change the value to <useSecurity>false</useSecurity>.

    3. Save $JENKINS_HOME/config.xml.

  4. Start the Jenkins service.

  5. Create a new Client Master in Operations Center and push the modified configuration in $JENKINS_HOME/config.xml to it.

Managing credentials when moving jobs between masters

If you are moving a set of jobs from a monolithic master to a Team Master and you receive "duplicate instance" errors:

  1. Stop Jenkins.

  2. Change to the $JENKINS_HOME directory.

  3. Delete the secret.key file.

  4. Delete the license.xml file.

  5. Start Jenkins.

Go to Manage JenkinsManage License to display your instance ID. You can also go to https://$JENKINS_URL/license to view the instance ID associated with your license.

Managing credentials when migrating from CloudBees Jenkins Enterprise v1 to CloudBees CI

If you are migrating from CloudBees Jenkins Enterprise v1 to CloudBees CI and need to manage credentials, see "Migrate credentials" in the CloudBees Jenkins Enterprise 1.x to CloudBees CI on modern cloud platforms migration guide.

The key in $JENKINS_HOME/secrets/secrets.key is used to encrypt the credentials file, $JENKINS_HOME/credentials.xml. It allows provides a unique Jenkins instance ID.

If you use a backup that contains a different Jenkins instance ID (for example, you restore the $JENKINS_HOME of one server on a different server, your jobs will fail because they have different credentials associated with it.

Your jobs will also fail if you copy/restore jobs with a different instance ID for a different Jenkins server.