How do I use SSH in a Jenkins pipeline?

后端 未结 4 1148
离开以前
离开以前 2020-12-09 18:09

I have some Jenkins jobs defined using a Jenkins Pipeline Model Definition, which builds NPM projects. I use Docker containers to build these projects (using a common image

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-09 18:13

    To add a remote host to known hosts and hopefully cope with your error try to manually ssh from the Jenkins host to the target host as the Jenkins user.

    Get on the host where Jenkins is installed. Type

    sudo su jenkins
    

    Now use ssh or scp like

    ssh username@server
    

    You should be prompted like this:

    The authenticity of host 'server (ip)' can't be established. ECDSA key fingerprint is SHA256:some-weird-string. Are you sure you want to continue connecting (yes/no)?

    Type yes. The server will be permanently added as a known host. Don't even bother passing a password, just Ctrl + C and try running a Jenkins job.

提交回复
热议问题