Skip to content

Instantly share code, notes, and snippets.

@lpetre
Created February 27, 2017 14:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lpetre/178f7c57ee1453bf0ce0d449e8e217a7 to your computer and use it in GitHub Desktop.
Save lpetre/178f7c57ee1453bf0ce0d449e8e217a7 to your computer and use it in GitHub Desktop.
node {
withEnv(['PATH+GIT=C:\\Program Files\\Git\\usr\\bin\\']) {
echo env.PATH.split(/;/).join("\n")
if (fileExists('c:\\Program Files\\Git\\usr\\bin\\ssh-agent.exe')) {
echo 'Yes'
} else {
echo 'No'
}
sshagent (credentials: ['foo']) {
sh 'ssh -o StrictHostKeyChecking=no -l 1.2.3.4 uname -a'
}
}
}
@lpetre
Copy link
Author

lpetre commented Feb 27, 2017

Could not find ssh-agent: IOException: Cannot run program "ssh-agent": CreateProcess error=2, The system cannot find the file specified
Check if ssh-agent is installed and in PATH

@lpetre
Copy link
Author

lpetre commented Feb 27, 2017

[Pipeline] {
[Pipeline] withEnv
[Pipeline] {
[Pipeline] echo
C:\Program Files\Git\usr\bin\
...
[Pipeline] fileExists
[Pipeline] echo
Yes
[Pipeline] sshagent
[ssh-agent] Using credentials ec2-user (hns-test-ssh)
[ssh-agent] Looking for ssh-agent implementation...
Could not find ssh-agent: IOException: Cannot run program "ssh-agent": CreateProcess error=2, The system cannot find the file specified
Check if ssh-agent is installed and in PATH
[ssh-agent] FATAL: Could not find a suitable ssh-agent provider
[ssh-agent] Diagnostic report
[Pipeline] // sshagent
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline
java.lang.RuntimeException: [ssh-agent] Could not find a suitable ssh-agent provider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment