I'm trying to run remote commands using ssh from jenkinsfile. For this I'm using *.pem file for accessing the remote machine. I already have jenkins credentials created with the type "SSH Username with private key" inside jenkins.
Is there any way that i can use that credential inside jenkinsfile instead of giving sh "ssh -i *.pem username@hostname command" to authenticate?