jenkinsci / jenkinsci/ssh-credentials-plugin
[JENKINS-68162] NullPointerException from withCredentials > sshUserPrivateKey
- Dominant language
- Java
- Stars
- 25
- Forks
- 69
- PR merge metrics
- No merged PRs in 30d
Description
Hello!
Here is a snippet from Pipeline:
sshagent(["AWSServerPrivateKey-${params.URL}"]) {
withCredentials([sshUserPrivateKey(credentialsId: "AWSServerPrivateKey-${params.URL}", usernameVariable: 'userName')]) {
sh "cat hello.txt"
}
}
I get the following error
[Pipeline] }
[Pipeline] // script
[Pipeline] }[Pipeline] // ansiColor
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (deploy)
[Pipeline] sshagent
[ssh-agent] Using credentials *** (AWSServerPrivateKey)
[ssh-agent] Looking for ssh-agent implementation...
[ssh-agent] Exec ssh-agent (binary ssh-agent on a remote machine)
$ ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-2FrmRJy4jjPF/agent.2510759
SSH_AGENT_PID=2510761
Running ssh-add (command line suppressed)
Identity added:
...
[ssh-agent] Started.
[Pipeline] {
[Pipeline] withCredentials
Masking supported pattern matches of $null
[Pipeline] {
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }
$ ssh-agent -k
unset SSH_AUTH_SOCK;
unset SSH_AGENT_PID;
echo Agent pid 2510761 killed;
[ssh-agent] Stopped.
[Pipeline] // sshagent
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] sh
...
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.lang.NullPointerException
Finished: FAILURE
Please advise.
---
Originally reported by dguha, imported from: NullPointerException from withCredentials > sshUserPrivateKey
jvz
Raw content of original issue
Hello!
Here is a snippet from Pipeline:
sshagent(["AWSServerPrivateKey-${params.URL}"]) {
withCredentials([sshUserPrivateKey(credentialsId: "AWSServerPrivateKey-${params.URL}", usernameVariable: 'userName')]) {
sh "cat hello.txt"
}
}I get the following error
[Pipeline] }
[Pipeline] // script
[Pipeline] }[Pipeline] // ansiColor
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (deploy)
[Pipeline] sshagent
[ssh-agent] Using credentials *** (AWSServerPrivateKey)
[ssh-agent] Looking for ssh-agent implementation...
[ssh-agent] Exec ssh-agent (binary ssh-agent on a remote machine)
$ ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-2FrmRJy4jjPF/agent.2510759
SSH_AGENT_PID=2510761
Running ssh-add (command line suppressed)
Identity added:
...
[ssh-agent] Started.
[Pipeline] {
[Pipeline] withCredentials
Masking supported pattern matches of $null
[Pipeline] {
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] }
$ ssh-agent -k
unset SSH_AUTH_SOCK;
unset SSH_AGENT_PID;
echo Agent pid 2510761 killed;
[ssh-agent] Stopped.
[Pipeline] // sshagent
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] sh
...
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.lang.NullPointerException
Finished: FAILUREPlease advise.
Contributor guide
Assessment
This issue has not been assessed yet.