-
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 <<" }
[JENKINS-72716] credentialsId shows different in `Jenkins.instance.nodes` and `Jenkins.instance.computers`
Description |
Original:
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: {code:groovy} 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() println computer.launcher?.credentialsId?.toString() } "DONE" {code} screenshot: !image-2024-02-14-22-14-26-887.png|height=444! BTW, here is the groovy script to update nodes credential: {code:groovy} 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 <<" } {code} |
New:
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: {code:groovy} 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 } "DONE" {code} screenshot: !image-2024-02-14-22-14-26-887.png|height=444! BTW, here is the groovy script to update nodes credential: {code:groovy} 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 <<" } {code} |
Description |
Original:
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: {code:groovy} 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 } "DONE" {code} screenshot: !image-2024-02-14-22-14-26-887.png|height=444! BTW, here is the groovy script to update nodes credential: {code:groovy} 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 <<" } {code} |
New:
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: {code:groovy} 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 } "DONE" {code} screenshot: !image-2024-02-14-22-14-26-887.png|height=444! BTW, here is the groovy script to update nodes credential: {code:groovy} 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 <<" } {code} |
Labels | New: Node SlaveComputer |
Labels | Original: Node SlaveComputer | New: DumbSlave Node SlaveComputer |
Attachment | New: image-2024-02-14-22-33-44-839.png [ 62101 ] | |
Description |
Original:
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: {code:groovy} 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 } "DONE" {code} screenshot: !image-2024-02-14-22-14-26-887.png|height=444! BTW, here is the groovy script to update nodes credential: {code:groovy} 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 <<" } {code} |
New:
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: {code:groovy} 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 } "DONE" {code} screenshot: !image-2024-02-14-22-33-44-839.png|height=400px! BTW, here is the groovy script to update nodes credential: {code:groovy} 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 <<" } {code} |
Attachment | Original: image-2024-02-14-22-14-26-887.png [ 62100 ] |
Description |
Original:
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: {code:groovy} 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 } "DONE" {code} screenshot: !image-2024-02-14-22-33-44-839.png|height=400px! BTW, here is the groovy script to update nodes credential: {code:groovy} 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 <<" } {code} |
New:
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()}}: {code:groovy} 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 } {code} {{node.toComputer()}}: {code:groovy} 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() } {code} screenshot: !image-2024-02-14-22-33-44-839.png|height=400! BTW, here is the groovy script to update nodes credential: {code:groovy} 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 <<" } {code} |
Component/s | New: ssh-slaves-plugin [ 15578 ] | |
Component/s | Original: ssh-agent-plugin [ 17509 ] |
Does it get back in sync if you call SlaveComputer.setNode(Node), which would then do launcher = grabLauncher(node);? The setNode method is protected but perhaps you can call it via Jenkins.setNodes(List).