Details
-
Bug
-
Status: Resolved (View Workflow)
-
Minor
-
Resolution: Fixed
-
None
-
-
ssh-credentials-1.17.1
Description
Repro:
- Add Credentials
- set Kind to "SSH Username with private key"
- tick "enter directly"
- paste a password-less private key without a trailing newline - Attempt to use credentials (I used ssh-agent from a Jenkinsfile)
- Observe that ssh-add will prompt for a passphrase in the logs and the ssh-add has failed.
The relevant part of my logs looked like this:
```
[Pipeline] sshagent
[ssh-agent] Using credentials jenkins (Github SSH key)
[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-rEGjLSRTHULl/agent.3927
SSH_AGENT_PID=3929
[ssh-agent] started an agent
$ ssh-add /var/lib/jenkins/workspace/job@tmp/private_key_2980200938951827942.key
Enter passphrase for /var/lib/jenkins/workspace/job@tmp/private_key_2980200938951827942.key: [Pipeline] // sshagent
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: Failed to run ssh-add
Finished: FAILURE
```
Adding the trailing newline to input in the web-ui resolves this issue. Adding multiple newlines didn't seem have any adverse effect so Jenkins should probably just add a newline when it writes the keyfile.
Attachments
Issue Links
- is duplicated by
-
JENKINS-43564 Ensure newline at the end of SSH key blocks
-
- Resolved
-
- links to
After upgrading to ssh-agent 1.21 we had a job hang at a git command.
We terminated it after more than 30 minutes. Tried again and again with same result.
After reverting to 1.20 it worked again.
Versions:
Log:
... [Pipeline] sshagent 15:27:55 [ssh-agent] Using credentials jenkins (jenkins ssh key) 15:27:55 [ssh-agent] Looking for ssh-agent implementation... 15:27:55 [ssh-agent] Exec ssh-agent (binary ssh-agent on a remote machine) 15:27:55 $ docker exec bb2595d46378e3aa4279cba0a20d8e3026f79d84bc9d2f2b5b856bbfba3ab1f5 ssh-agent 15:27:55 [ssh-agent] Java/JNR ssh-agent 15:27:55 [ssh-agent] Registered BouncyCastle on the remote agent 15:27:55 [ssh-agent] Started. [Pipeline] { [Pipeline] sh 15:27:55 + git ls-remote --heads origin