How to migrate credentials to a new Jenkins instance

Issue

  • I have a new instance of Jenkins and want to migrate credentials from an old instance.

Environment

  • CouldBees CloudBees Jenkins Enterprise (CJE)
  • CloudBees Operations Center (CJOC)
  • Jenkins
  • Credentials Plugin

Resolution

You have to copy some files from old instance to the new one and regenerate identity.key.enc file.

cp -R OLD_JENKINS_HOME/secret* JENKINS_HOME
cp OLD_JENKINS_HOME/credentials.xml JENKINS_HOME
rm JENKINS_HOME/identity.key.enc 

This migrates the global scope credentials, in order to migrate folder and user scope credentials, you have to copy credentials.xml files on folders (JENKINS_HOME/jobs/FODER_NAME/credentials.xml) and users (JENKINS_HOME/users/USER_NAME/credentials.xml) to the new place in the new instance.

Have more questions? Submit a request

1 Comments

  • 0
    Avatar
    Aurelio Soria

    This worked for me without deleting secret and the identity files. But, my old jenkins is v. 1.599 to latest CJE. I just stop jenkins secure copy over credentials.xml and start jenkins. All good.

Please sign in to leave a comment.