Copying Jenkins home gives duplicate instance ids

Issue

  • Copying JENKINS_HOME causes duplicate instance ids.
  • Multiple masters same instance id
  • Create/regenerate a new instance id.

Environment

  • CloudBees Jenkins Enterprise
  • CloudBees Jenkins Operations Center
  • Jenkins + Nectar License plugin

Resolution

If you need to duplicate a Jenkins instance by copying the entire JENKINS_HOME it will lead to duplicate instance ids. You can re-create the instance id for the new Jenkins installation by doing the following:

  1. Stopped the Jenkins instance.
  2. cd to $JENKINS_HOME
  3. Delete the current secret.key file: rm secret.key
  4. Delete the license.xml file: rm license.xml
  5. Start Jenkins again.

Going to Manage Jenkins > Manage License (or JENKINS_URL/license) will display a new instance id.

Have more questions? Submit a request

3 Comments

  • 1
    Avatar
    Alexander Ost

    It seems that some additional steps are required when copying a JENKINS_HOME of a 2.7.19.1 CJEE master that's connected to CJOC. I had to force-push a new clienst master connection from cjoc side to get the copy running properly.

    Edited by Alexander Ost
  • 0
    Avatar
    Brian Vandegriend

    I tried these steps with Jenkins 2.7.19 and it doesn't work (I'm not using Operation center). 

    I deleted the secrets.key file along with license.xml. When I restarted the Jenkins service on the test server, I got this fatal error: "An error occurred: Default update site connectivity check failed with fatal error: Cannot check connection status of the update site with ID='cje-offline'." 

     

  • 0
    Avatar
    Lokesh Kamalay

    maybe this information related to CJP is outdated now as CJE and Jenkins X are dominating,

    I had to follow these steps to make it work.

    1. Login to Jenkins Master and Remove all these files

    • $JENKINS_HOME/license.xml
    • $JENKINS_HOME/operations-center-cloud*
    • $JENKINS_HOME/operations-center-client*
    • $JENKINS_HOME/com.cloudbees.opscenter.client.plugin.OperationsCenterRootAction.xml

    2. Disable the Security,

    Open $JENKINS_HOME/config.xml. Locate this line: <useSecurity>true</useSecurity> and changing it to <useSecurity>false</useSecurity>


    3. Start the Jenkins Service


    4. Create a new client master in CJOC and push the configuration which will now allow you to connect successfully.

Please sign in to leave a comment.