【发布时间】:2020-04-26 00:51:07
【问题描述】:
我安装了 jenkins ssh 代理插件。我在 linux 服务器上创建了 ssh 私钥(使用 ssh-keygen -t rsa 命令)我正在尝试连接。然后在 jenkins credintials 下添加 SSH 用户名和私钥 以及所有必填字段。在 jenkinsfile 中添加了运行 ssh 的简单命令:
pipeline {
agent any
stages {
stage('---doingsomething---') {
steps {
sshagent (credentials: ['jbowner-195']) {
sh 'ssh -o StrictHostKeyChecking=no -l jbowner 10.10.23.195 uname -a'
}
}
}
}
}
当我按下构建按钮时,进程正在开始并且永无止境。没有错误,没有超时问题。 这是 jenkins 堆栈的输出片段
[Pipeline] }
[Pipeline] // stage
[Pipeline] withEnv
[Pipeline] {
[Pipeline] stage
[Pipeline] { (---echoing---)
[Pipeline] sshagent
[ssh-agent] Using credentials jbowner (jbowner 10.10.23.195)
[ssh-agent] Looking for ssh-agent implementation...
[ssh-agent] Exec ssh-agent (binary ssh-agent on a remote machine)
$ ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-XSQPEUHOqZQR/agent.10226
SSH_AGENT_PID=10229
Running ssh-add (command line suppressed)
Identity added: /home/jenkins/.jenkins/workspace/Eformgenerator-Prod@tmp/private_key_5151715321960722060.key (/home/jenkins/.jenkins/workspace/Eformgenerator-Prod@tmp/private_key_5151715321960722060.key)
[ssh-agent] Started.
[Pipeline] {
[Pipeline] sh
+ ssh -o StrictHostKeyChecking=no -l jbowner 10.10.23.195 uname -a
有什么想法吗?
【问题讨论】:
-
exit或ssh-agent -k怎么样? -
@MartinZeitler 在哪里或如何?我没明白。