- I have a new instance of Jenkins and want to migrate credentials from an old instance.
- CouldBees CloudBees Jenkins Enterprise (CJE)
- CloudBees Operations Center (CJOC)
- Credentials Plugin
1. Stop new and old Jenkins instances.
2. (optional) Delete file
identity.key.enc from $NEW_JENKINS_HOME/identity.key.enc. In case you don’t delete it manually, it will be done automatically after the next restart
SEVERE: identity.key.enc is corrupted. Identity.key.enc will be deleted and a new one will be generated javax.crypto.BadPaddingException: Given final block not properly padded
For migrating Global scope credentials:
3. Copy secret files and folder from $OLD_JENKINS_HOME/secret* to the new $NEW_JENKINS_HOME root
credentials.xml file from $OLD_JENKINS_HOME/credentials.xml to the $NEW_JENKINS_HOME root
rm JENKINS_HOME/identity.key.enc cp -R OLD_JENKINS_HOME/secret* JENKINS_HOME cp OLD_JENKINS_HOME/credentials.xml JENKINS_HOME
For migrating Folder and User scope credentials:
credentials.xml files from $OLD_JENKINS_HOME/jobs/FOLDER_NAME/credentials.xml to $NEW_JENKINS_HOME/jobs/FOLDER_NAME/. This should be done in each folder you would like to migrate and should be adapted to your specific folder paths/structure.
credentials.xml files from $OLD_JENKINS_HOME/users/USER_NAME/credentials.xml to $NEW_JENKINS_HOME/users/USER_NAME/. This should be done in each of the users you would like to migrate.
7. Finally, restart the instances and the
identity.key.enc should be regenerated on the new instance.