2017-12-02 15 views
0

나는에 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'"