-
Type:
Bug
-
Resolution: Not A Defect
-
Priority:
Major
-
Component/s: ssh-agent-plugin
-
Environment:Jenkins 1.545, OS X 10.9.1, credentials 1.9.4, ssh-credentials 1.6, ssh-agent 1.4.1
I use ssh keys with Jenkins to communicate with Github and Bitbucket. I've previously injected SSH_AUTH_SOCK env vars into jobs, until I installed the ssh-agent plugin yesterday, with the goal of using SSH keys to poll for changes, where environment variables aren't available.
After jumping through setup hoops and stripping out my SSH_AUTH_SOCK variables, when I manually start a build, Jenkins correctly uses its stored SSH key credential to access Bitbucket. However, job polling continues to fail with what appears to be an SSH authorization problem:
Started on Jan 4, 2014 5:16:17 PM Using strategy: Default [poll] Last Built Revision: Revision 0919a53989bdab78bcfb6b8626b8517d33006cdd (origin/develop) FATAL: hudson.plugins.git.GitException: Command "git ls-remote -h git@bitbucket.org:companyname/companyname-ios-us.git develop" returned status code 128: stdout: stderr: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. hudson.util.IOException2: hudson.plugins.git.GitException: Command "git ls-remote -h git@bitbucket.org:companyname/companyname-ios-us.git develop" returned status code 128: stdout: stderr: Permission denied (publickey). fatal: Could not read from remote repository.
I've verified that the same SSH key that fails when polling is accepted for manually-invoked builds (there's only one Bitbucket SSH key stored in Jenkins). I removed the username from the example, but copied and pasted, `git ls-remote -h git@bitbucket.org:companyname/companyname-ios-us.git develop` does return valid data when run interactively under this same SSH key.
Further, I see the same authorization error at Github when I perform similar key setup and attempt to poll a Github project. The Github key likewise succeeds interactively, and in manual Jenkins builds.
I'm about out of ideas as to why ssh-agent is ineffective when Jenkins is polling, even while it says it's trying to use the correct key. Any suggestions or further inquiries would be welcome.