-
Bug
-
Resolution: Not A Defect
-
Minor
-
None
-
Jenkins (version 2.150.2)
ssh steps plugin (version 1.2.1)
Hello,
This is a question more than a bug report.
I'd like to use ssh private key account (with passphrase) from Jenkins credentials store.
I did successfully used this plugin with an ssh key pair in a scripted pipeline using the provided code sample below
https://github.com/jenkinsci/ssh-steps-plugin#withcredentials
My groovy code looks like this
def remote = [:]
remote.name = "hostname"
remote.host = "hostname"
remote.allowAnyHosts = true
node {
withCredentials([sshUserPrivateKey(credentialsId: 'xxxxx-xxxxx-xxxx', keyFileVariable: 'identity', passphraseVariable: 'passphrase', usernameVariable: 'userName')]) {
remote.user = userName
remote.identityFile = identity
remote.passphrase = passphrase
stage("SSH Steps Rocks!") {
writeFile file: 'abc.sh', text: 'ls'
sshPut remote: remote, from: 'abc.sh', into: '.'
}
}
I've tried in several way to use Declarative Pipeline but without success.
Do you have any tips or samples to share ?
Thanks for your help.
Davide