Hi,

I haven't been able to get ssh-agent and checkout scm to work together,
e.g.:

node('slave') {
  sshagent (credentials: ['master-credentials']) {
    checkout scm
  }
}

For some reason the ssh-agent is stopped before the checkout is executed:

[Pipeline] node
Running on ... (truncated)
[Pipeline] {
[Pipeline] sshagent
[ssh-agent] Using credentials master-credentials
[ssh-agent] Looking for ssh-agent implementation...
[ssh-agent]   Java/JNR ssh-agent
[ssh-agent] Registered BouncyCastle on the remote agent
[ssh-agent] Started.
[Pipeline] {
[Pipeline] checkout
[ssh-agent] Stopped.
Cloning the remote Git repository
Cloning repository git@github.mydomain:Organization/my-project.git
 > git init ... (truncated)
 > git --version # timeout=10
 > git fetch  ... (truncated)
ERROR: Error cloning remote repo 'origin'
hudson.plugins.git.GitException: Command "git fetch --tags --progress
git@github.mydomain:Organization/my-project.git
+refs/heads/*:refs/remotes/origin/*"
returned status code 128:
stdout:
stderr: Permission denied (publickey).
fatal: The remote end hung up unexpectedly


It doesn't work with the 'git' step either:

node('slave') {
  sshagent (credentials: ['master-credentials']) {
    git url: "git@github.mydomain:Organization/my-project.git"
  }
}


But it does work with 'sh':

node('slave') {
  sshagent (credentials: ['master-credentials']) {
    sh 'git clone git@github.mydomain:Organization/my-project.git'
  }
}


What's the difference between these? How come the ssh-agent is allowed to
stop before the end of its closure with the first two versions and not with
'sh'?

Thanks,

- Sebastien

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CADKdwMEk3gqNXm19-rMCQ0a1J1pvufaHRS47yQoCZJFeQnA9cw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to