Example Pipeline Script
def remote = [:]
remote.name = "suranga"
remote.host = "192.168.143.12"
remote.allowAnyHosts = true
node {
withCredentials([sshUserPrivateKey(credentialsId: 'node-ssh', keyFileVariable: 'identity', passphraseVariable: '', usernameVariable: 'suranga')]){
remote.user = suranga
remote.identityFile = identity
properties([gitLabConnection(gitLabConnection: 'gitlab-connection', jobCredentialId: ''), parameters([string(defaultValue: 'choose', name: 'Enter_Command')])])
stage("check"){
sshCommand remote: remote, command: "${Enter_Command}"
}
}
}