2017-12-02 5 views
0

私はbuilding-serverを持っています。私はJenkins 2.73.3を持っています。Jenkins、ホストキーの確認に失敗しました。スクリプトは終了コード255を返しました

building-serverから他のサーバーに接続するための資格情報も設定しました。

しかし、別のサーバーを追加するたびに、私は新しいサーバーとコマンドラインで承認されたキーを設定するので、追加するのは難しくなりますが、Jenkinsでは動作しません。ここで

は失敗し少しレシピです:

pipeline { 
    agent any 

    stages { 

    stage('Set conditions') { 
     steps { 
     sshagent(['xxxx-xxxx-xxxx-xxxx-xxxx']) { 
      sh "ssh [email protected] 'echo $HOME'" 
     } 
     } 
    } 

    } 
} 

そしてここでは、ログインの失敗です:

[ssh-agent] Started. 
[Pipeline] { 
[Pipeline] sh 
[check] Running shell script 
+ ssh [email protected] 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 

答えて

1

それは解決策はシェルスクリプトラインにパラメータStrictHostKeyCheckingを追加することだったようだ

sh "ssh -o StrictHostKeyChecking=no [email protected] 'echo $HOME'" 
関連する問題