ok, so.... What I have discovered. If I manually in the UI, start the job and add the parameters... my build works, ssh-agent works, it finds the key, loads it and github SCM works.
If I run the job, with the same parameter values from curl/using the command line..... it does not work and can not find the key. Build run from curl: Building remotely on jenkins-slave-rn7w5 <https://jenkins.k8s.hipages.com.au/computer/jenkins-slave-rn7w5> (jenkins-jenkins-slave) in workspace /home/jenkins/workspace/core-build Running Prebuild steps [core-build] $ /bin/bash -xe /tmp/jenkins3412092671259899558.sh + ssh-keyscan github.com # github.com:22 SSH-2.0-libssh_0.7.0 # github.com:22 SSH-2.0-libssh_0.7.0 # github.com:22 SSH-2.0-libssh_0.7.0 + ssh-keygen -lf githubKey 2048 SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8 github.com (RSA) + mkdir -p /home/jenkins/.ssh + cp githubKey /home/jenkins/.ssh/known_hosts + chmod 400 /home/jenkins/.ssh/known_hosts + cp -r /home/jenkins/.ssh /root/ Success build forhudson.tasks.Shell@4efa51a FATAL: java.io.IOException: [ssh-agent] Could not find specified credentials at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper.preCheckout(SSHAgentBuildWrapper.java:209) at jenkins.scm.SCMCheckoutStrategy.preCheckout(SCMCheckoutStrategy.java:76) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:490) at hudson.model.Run.execute(Run.java:1724) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:421) FATAL: [ssh-agent] Could not find specified credentials java.io.IOException: [ssh-agent] Could not find specified credentials at com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper.preCheckout(SSHAgentBuildWrapper.java:209) at jenkins.scm.SCMCheckoutStrategy.preCheckout(SCMCheckoutStrategy.java:76) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:490) at hudson.model.Run.execute(Run.java:1724) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:421) Finished: FAILURE Build where I manually run it in the UI: Started by user Jurgen Weber <https://jenkins.k8s.hipages.com.au/user/[email protected]> Building remotely on jenkins-slave-lxlqs <https://jenkins.k8s.hipages.com.au/computer/jenkins-slave-lxlqs> (jenkins-jenkins-slave) in workspace /home/jenkins/workspace/core-build Running Prebuild steps [core-build] $ /bin/bash -xe /tmp/jenkins9161791465985411390.sh + ssh-keyscan github.com # github.com:22 SSH-2.0-libssh_0.7.0 # github.com:22 SSH-2.0-libssh_0.7.0 # github.com:22 SSH-2.0-libssh_0.7.0 + ssh-keygen -lf githubKey 2048 SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8 github.com (RSA) + mkdir -p /home/jenkins/.ssh + cp githubKey /home/jenkins/.ssh/known_hosts + chmod 400 /home/jenkins/.ssh/known_hosts + cp -r /home/jenkins/.ssh /root/ Success build forhudson.tasks.Shell@66cf5060 [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-zU37OMCq2Skj/agent.127 SSH_AGENT_PID=129 [ssh-agent] Started. $ ssh-add /home/jenkins/workspace/core-build@tmp/private_key_7170551602733961435.key Identity added: /home/jenkins/workspace/core-build@tmp/private_key_7170551602733961435.key (/home/jenkins/workspace/core-build@tmp/private_key_7170551602733961435.key) [ssh-agent] Using credentials git (trench-deploy-key) Wiping out workspace first. Cloning the remote Git repository ...................... I have tried varying formats of the curl with the same result: curl -i -X POST https://jenkins:8080/buildByToken/buildWithParameters --data token=MYTOKEN --data job=core-build --data repo_name_deploy_key="MYREPO-deploy-key" --data repo_name=MYREPO --data repo_http_url=https://github.com/EXAMPLE/MYREPO --data [email protected]:EXAMPLE/MYREPO.git -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/cc6c276f-99f0-4f7f-884c-57d83255856d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
