Это просто, вы можете просто перейти на сцену выше удаленных шагов. Раньше я делал, как показано ниже. (Я использовал закрытый ключ для аутентификации s sh)
steps {
script {
def remote = [:]
withCredentials([
sshUserPrivateKey(credentialsId: 'PRIVATE_KEY_FILE', keyFileVariable: 'identityFile', passphraseVariable: 'passphrase', usernameVariable: 'userName')
]) {
remote.name = "test.host.com"
remote.host = "10.0.0.1"
remote.allowAnyHosts = true
remote.user = userName
remote.identityFile = identityFile
remote.passphrase = passphrase
sshScript remote: remote, script: "runTestScript.sh"
}
}
}
См. https://github.com/jenkinsci/ssh-steps-plugin#pipeline -шаги