-
Bug
-
Resolution: Not A Defect
-
Critical
-
Jenkins: 2.426.3
OS: Linux - 4.19.12-1.el7.elrepo.x86_64
Java: 11.0.21 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)
---
mina-sshd-api-common:2.12.0-90.v9f7fb_9fa_3d3b_
mina-sshd-api-core:2.12.0-90.v9f7fb_9fa_3d3b_
ssh-agent:346.vda_a_c4f2c8e50
ssh-credentials:308.ve4497b_ccd8f4
ssh-slaves:2.948.vb_8050d697fec
sshd:3.322.v159e91f6a_550Jenkins: 2.426.3 OS: Linux - 4.19.12-1.el7.elrepo.x86_64 Java: 11.0.21 - Eclipse Adoptium (OpenJDK 64-Bit Server VM) --- mina-sshd-api-common:2.12.0-90.v9f7fb_9fa_3d3b_ mina-sshd-api-core:2.12.0-90.v9f7fb_9fa_3d3b_ ssh-agent:346.vda_a_c4f2c8e50 ssh-credentials:308.ve4497b_ccd8f4 ssh-slaves:2.948.vb_8050d697fec sshd:3.322.v159e91f6a_550
I've been updated credential ID in the SSH Agent ( hudson.plugins.sshslaves.SSHLauncher ), when I using script to check the credentialsId status, find out the jenkins.model.Jenkins.instance.nodes works as I saw in configure page, however, the jenkins.model.Jenkins.instance.computers still shows the legacy ( previous ) credentialsId .
groovy script for list nodes credentials:
computer.getNode():
Jenkins.instance.computers.findAll { computer -> ! jenkins.model.Jenkins.MasterComputer.isInstance(computer) && computer?.launcher instanceof hudson.plugins.sshslaves.SSHLauncher }.each { computer -> println computer.node.launcher?.credentialsId?.toString() // shows updated, same with configuration page println computer.launcher?.credentialsId?.toString() // issue: shows the legacy credentialsId }
node.toComputer():
Jenkins.instance.nodes.findAll { node -> ! jenkins.model.Jenkins.MasterComputer.isInstance(node) && node?.launcher instanceof hudson.plugins.sshslaves.SSHLauncher }.each { node -> println node.launcher?.credentialsId?.toString() + ' : ' + node.getClass() println node.toComputer().launcher?.credentialsId?.toString() + ' : ' + node.toComputer().getClass() }
screenshot:
BTW, here is the groovy script to update nodes credential:
import jenkins.model.Jenkins import hudson.plugins.sshslaves.SSHLauncher import hudson.slaves.ComputerLauncher String newCredId = 'GIT_SSH_CREDENTIAL' Jenkins.instance.nodes.findAll { node -> ! jenkins.model.Jenkins.MasterComputer.isInstance(node) && node?.launcher instanceof hudson.plugins.sshslaves.SSHLauncher }.each { node -> ComputerLauncher launcher = node.launcher SSHLauncher newLauncher = new SSHLauncher( launcher.host, launcher.port, newCredId ) node.setLauncher( newLauncher ) node.save() println ">> ${node.name} DONE <<" }