Hello everyone,

I am stuck with one odd problem where i am trying to run remote command on 
linux server from my slave machine (windows server) as part of Pipeline 
script. As SSH connections are only supported using Private/Public Keys, i 
did follow steps mentioned in 
blog 
https://medium.com/@weblab_tech/how-to-publish-artifacts-in-jenkins-f021b17fde71
 
to generate keys to be later used for calls. Below are things i have done 
so far:
- Connected to slave server and created key using ssh-keygen.
- Created new credential using key/passphrase in Jenkins (id as 
server_ssh_key).
- Copied over the public key under /authorized_keys (id_rsa.pub) on the 
remote server.
- Connected from Slave server to the remote linux server through console to 
allow entry to "known host" file on the slave server.
- Updated Pipeline script to use below code to allow use of newly created 
credentials.
pipeline {
    options {
        timestamps()
    }
    agent {label 'att_server_slave'}
    stages {
        stage('Builds') {
steps {
script{ 
stage ('Starting build_rhel56_x64_1')  
{
  sshagent(credentials: ['server_ssh_key']) {

ssh '[email protected] ls'
}
}
}
}
        }
    }
}

when i am trying to run this pipeline script, i am getting below error:

00:13:26 [ssh-agent] Using credentials root
00:13:26 [ssh-agent] Looking for ssh-agent implementation...
00:13:27 [ssh-agent]   Exec ssh-agent (binary ssh-agent on a remote machine)
00:13:27 $ ssh-agent
00:13:27 SSH_AUTH_SOCK=/tmp/ssh-OzJHVK5660/agent.5660
00:13:27 SSH_AGENT_PID=6056
00:13:27 $ ssh-add 
C:\EngineJenkins\workspace\pipeline_test@tmp\private_key_3271471486698300052.key
00:13:28       3 [main] *ssh-add 2176 tty_list::allocate_tty: No tty 
allocated*

Can someone please help in understanding what wrong i am doing? Or what 
specific check/step i am missing?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/73636eda-0809-441d-8b99-65f97b6236e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to