Jenkins Plugin & Pipeline

执行远程Shell命令和文件拷贝

todo

参考:How do I use SSH in a Jenkins pipeline?

Step 1 - create SSH keys in remote host server, include the key to authorized_keys

Step 2 - Create credential using SSH keys in Jenkins, use the private key from the remote host

The below step is added to the pipeline:

stage ('Deploy') {
    steps{
        sshagent(credentials : ['use-the-id-from-credential-generated-by-jenkins']) {
            sh 'ssh -o StrictHostKeyChecking=no [email protected] uptime'
            sh 'ssh -v [email protected]'
            sh 'scp ./source/filename [email protected]:/remotehost/target'
        }
    }
}

离线Plugin 安装

Jenkins Plugin & Pipeline_第1张图片
插件hpi文件可以去 http://updates.jenkins-ci.org/download/plugins/ 下载。

插件可能会依赖其他插件,去找依赖的插件也上传上去。

你可能感兴趣的:(构建工具)