If you need to migrate a Jenkins Instance to newer instance, there may be need to import credentials. If that is the case then the following may help:
-
First stop both Jenkins instances.
-
Within the New Jenkins Instance remove the
identity.key.enc
file which can be found in$JENKINSHOME
$ rm identity.key.enc
- Zip up the
credentials.xml
file and anything beginning withsecret
in the$JENKINSHOME
directory. Afterwards we will send it to the new Jenkins instance.
$ tar -czvf credentials.tgz secret* credentials.xml
$ scp credentials.tgz user@new-jenkins-server:/tmp/
- Next extract the
credentials.tgz
file in the$JENKINSHOME
directory and start up your new Jenkins instance.
$ tar -xzvf /tmp/credentials.tgz $JENKINSHOME
After you start up your new Jenkins instance you should be set. Note that in the event you do not see the exported credentials, you should restart you new Jenkins instance.
_Special thanks to https://itsecureadmin.com/2018/03/jenkins-migrating-credentials/_