测试jenkins ssh登录远程机器操作

This commit is contained in:
zhouxiunai
2018-11-04 18:47:59 +08:00
parent 92b0c54df4
commit 8b79060234
Vendored
+10 -1
View File
@@ -13,9 +13,18 @@ pipeline {
} }
} }
stage('deploy') { stage('deploy') {
def remote = [:]
remote.name = "node-1"
remote.host = "130.120.3.231"
remote.allowAnyHosts = true
steps { steps {
sh 'echo deploy' withCredentials([sshUserPrivateKey(credentialsId: 'e41b57a4-436a-4617-817c-9e3f25a8a47f', keyFileVariable: 'identity', passphraseVariable: '', usernameVariable: 'userName')]) {
sshCommand remote: remote, command: 'docker stop adminapi'
}
sh 'echo deploy'
} }
} }
} }