我有一台构建服务器
,上面安装了Jenkins 2.73.3,并且还有其他用于部署应用程序的服务器。
我已经设置了一个凭据来连接构建服务器
与其他服务器。
但是每次我添加另一个服务器时,它都很难添加,因为虽然我在新服务器中设置了授权密钥,在命令行中可以工作,但在Jenkins中不能正常运行。
这里有一个失败的小配方:
pipeline {
agent any
stages {
stage('Set conditions') {
steps {
sshagent(['xxxx-xxxx-xxxx-xxxx-xxxx']) {
sh "ssh user@product.company.com 'echo $HOME'"
}
}
}
}
}
以下是日志错误信息:
[ssh-agent] Started.
[Pipeline] {
[Pipeline] sh
[check] Running shell script
+ ssh user@product.company.com echo /var/lib/jenkins
$ ssh-agent -k
unset SSH_AUTH_SOCK;
unset SSH_AGENT_PID;
echo Agent pid 12567 killed;
[ssh-agent] Stopped.
Host key verification failed.
[Pipeline] }
[Pipeline] // sshagent
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 255
Finished: FAILURE