Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-56403

Renaming jenkins agents persists previously named agent on restart

    • 2.174

      Renaming an agent does not persist across restarts, and jenkins loads back the old agent as well as the new agent. The root issue seems to be that the directory under ${JENKINS_HOME}/nodes/<agent> is left untouched on a rename, and is left alongside the one created for the new agent. 

      Steps to reproduce:

      1. Create a new agent
      2. Configure -> Rename the agent and click Save
      3. Restart Jenkins to see the old agent appear

      This caused several issues where the old and new agents were trying to connect to the same host, causing build issues

      This is reproducible on several jenkins LTS versions (2.107, 2.138, 2.150), so I'm not sure when it was introduced. 

          [JENKINS-56403] Renaming jenkins agents persists previously named agent on restart

          Anish Dangi created issue -
          Anish Dangi made changes -
          Summary Original: Renaming jenkins agents persists old agents alongside old agents on restart New: Renaming jenkins agents persists previously named agent on restart

          Anish Dangi added a comment -

          Anish Dangi added a comment - oleg_nenashev jglick
          Anish Dangi made changes -
          Labels New: core jenkins
          Jesse Glick made changes -
          Link New: This issue relates to JENKINS-27565 [ JENKINS-27565 ]

          Jesse Glick added a comment -

          If it is a regression my casual guess would be that it was introduced with Nodes by stephenconnolly in JENKINS-27565. Either way, it ought to be easy enough to fix given a functional test with RestartableJenkinsRule. I suspect Nodes.replaceNode needs to do a directory rename when the old and new names differ.

          Jesse Glick added a comment - If it is a regression my casual guess would be that it was introduced with Nodes by stephenconnolly in JENKINS-27565 . Either way, it ought to be easy enough to fix given a functional test with RestartableJenkinsRule . I suspect Nodes.replaceNode needs to do a directory rename when the old and new names differ.
          Anish Dangi made changes -
          Link New: This issue is caused by JENKINS-33780 [ JENKINS-33780 ]

          Anish Dangi added a comment -

          jglick This was caused by JENKINS-33780 . It replaced the prior method which performed a config save after updating the list of nodes, with the replaceNode method, which didn't do so. I opened a PR to address this. https://github.com/jenkinsci/jenkins/pull/3925

          Anish Dangi added a comment - jglick This was caused by  JENKINS-33780  . It replaced the prior method which performed a config save after updating the list of nodes, with the replaceNode  method, which didn't do so. I opened a PR to address this.  https://github.com/jenkinsci/jenkins/pull/3925
          Anish Dangi made changes -
          Remote Link New: This issue links to "PR 3925 (Web Link)" [ 22451 ]
          Jesse Glick made changes -
          Assignee New: Anish Dangi [ adangi ]

            adangi Anish Dangi
            adangi Anish Dangi
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: