Started on Apr 22, 2016 7:06:00 AM
[poll] Last Built Revision: Revision 256109511639dade5d95c561e54fffcc0e263cb0 (refs/remotes/origin/work/cascade)
> git --version # timeout=10
> git ls-remote -h git@mygithub:ORG/project.git # timeout=10
ERROR: polling failed in /app/jenkins/workspace/project-work-cascade-continuous on ab3-centos7-01
hudson.util.IOException2: hudson.plugins.git.GitException: Command "git ls-remote -h git@mygithub:ORG/project.git" returned status code 128:
stderr: Permission denied (publickey).
fatal: The remote end hung up unexpectedly
at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:529)
at org.jenkinsci.plugins.workflow.job.WorkflowJob.poll(WorkflowJob.java:531)
at hudson.triggers.SCMTrigger$Runner.runPolling(SCMTrigger.java:510)
at hudson.triggers.SCMTrigger$Runner.run(SCMTrigger.java:539)
at hudson.util.SequentialExecutionQueue$QueueEntry.run(SequentialExecutionQueue.java:118)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: hudson.plugins.git.GitException: Command "git ls-remote -h git@mygithub:ORG/project.git" returned status code 128:
stderr: Permission denied (publickey).
fatal: The remote end hung up unexpectedly
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1640)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1388)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1282)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1273)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.getHeadRev(CliGitAPIImpl.java:2376)
at hudson.plugins.git.GitSCM.compareRemoteRevisionWithImpl(GitSCM.java:583)
at hudson.plugins.git.GitSCM.compareRemoteRevisionWith(GitSCM.java:527)
[poll] Last Built Revision: Revision 256109511639dade5d95c561e54fffcc0e263cb0 (refs/remotes/origin/work/cascade)
> git --version # timeout=10
> git ls-remote -h git@mygithub:ORG/project.git # timeout=10
Normally on job where the polling succeeds (a non pipeline job) I'd expect the following:
Started on Apr 22, 2016 7:02:00 AM
[poll] Last Built Revision: Revision 9e4a511217a2af22478bf1f3959b449d30587981 (refs/remotes/origin/master)
using GIT_SSH to set credentials
> git --version # timeout=10
> git ls-remote -h git@mygithub:ORG/project.git # timeout=10
Found 113 remote heads on git@mygithub:ORG/project.git
[poll] Latest remote head revision on refs/heads/master is: 9e4a511217a2af22478bf1f3959b449d30587981 - already built by 398
The main difference is that the job that succeeds uses GIT_SSH to set the credentials. How do I set the GIT_SSH credentials for a pipeline script so that polling works?