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

Support ssh_agent_plugin with ssh_steps_plugin

    Details

    • Similar Issues:

      Description

      It would be great if the ssh agent plugin were supported so you could do the following

       

      def deployServer = 'remote.com'
      def deployUser = ''
      ssh_agent([deployCreds]) {
             withCredentials([sshUserPrivateKey(credentialsId: deployCreds, keyFileVariable: 'ssh_key', passphraseVariable: 'ssh_pw', usernameVariable: 'ssh_user')]) {
                    writeFile file: 'abc.sh', text: 'ls'
                    def remote = [:]
                    remote.name = deployServer
                    remote.host = deployServer
                    remote.user = "${env.ssh_user}"
                    remote.agent = true
                    remote.allowAnyHosts = true
                   sshCommand remote: remote, command: 'for i in {1..5}; do echo -n \"Loop \$i \"; date ; sleep 1; done'
                   sshPut remote: remote, from: 'abc.sh', into: '.'
             }
      }
       
      

       

      Currently when attempting this, an error is received: 

       

      com.jcraft.jsch.agentproxy.AgentProxyException: connector is not available: 
       at com.jcraft.jsch.agentproxy.ConnectorFactory.createConnector(ConnectorFactory.java:120)
       at com.jcraft.jsch.agentproxy.ConnectorFactory$createConnector.call(Unknown Source)
       at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
       at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
       at ...

        Attachments

          Activity

          Hide
          nrayapati Naresh Rayapati added a comment -

          I missed this one, curious why do you want to wrap these steps with ssh_agent step? I didn't get your use case, we don't need to wrap it around.

          Show
          nrayapati Naresh Rayapati added a comment - I missed this one, curious why do you want to wrap these steps with ssh_agent step? I didn't get your use case, we don't need to wrap it around.
          Hide
          jonl_percsol Jonathon Lamon added a comment -

          I wrote this after reading your other ticket about integrating the functionality of withCredentials into sshCommand.  Theoretically, with it wrapped in sshAgent, there should be no need to provide the credentials or server, etc, you should just be able to utilize the agent, no?  I would like to use sshAgent to reduce the boilerplate that is required for sshCommands.

          Show
          jonl_percsol Jonathon Lamon added a comment - I wrote this after reading your other ticket about integrating the functionality of withCredentials into sshCommand.  Theoretically, with it wrapped in sshAgent, there should be no need to provide the credentials or server, etc, you should just be able to utilize the agent, no?  I would like to use sshAgent to reduce the boilerplate that is required for sshCommands.
          Hide
          nrayapati Naresh Rayapati added a comment -

          sshagent is injecting these credentials to native linux process running on the jenkins agent, which is going to be in memory and no one can hack it.

          These steps are designed to run commands on the remote nodes but not on the Jenkins agents, so I think it is a bit hacky to use sshagent step.

          Show
          nrayapati Naresh Rayapati added a comment - sshagent is injecting these credentials to native linux process running on the jenkins agent, which is going to be in memory and no one can hack it. These steps are designed to run commands on the remote nodes but not on the Jenkins agents, so I think it is a bit hacky to use sshagent step.
          Hide
          nrayapati Naresh Rayapati added a comment -

          Jonathon Lamon Please reopen or create new Jira if you still need some help with the problem reported here. 

          Show
          nrayapati Naresh Rayapati added a comment - Jonathon Lamon Please reopen or create new Jira if you still need some help with the problem reported here. 

            People

            • Assignee:
              nrayapati Naresh Rayapati
              Reporter:
              jonl_percsol Jonathon Lamon
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: