the ssh-agent configuration isn't applied when pipeline is run on a docker container using the kubernetes plugin

       

      as an example, this pipeline works fine:

      sshagent in basic pipeline
      node {
          stage('Pre-Build') {
              sshagent (credentials: ['jenkins-master-ssh']) {
                  sh 'ssh -vT -o "StrictHostKeyChecking=no" git@github.com'
              }
          }
      }
      

      the job will fail, but the console output will clearly show the error from github 

      You've successfully authenticated, but GitHub does not provide shell access.

       

      whereas

      sshagent not applied in container 
      podTemplate(label: 'jenkpod', containers: [containerTemplate(name: 'golang', image: 'golang:1.8', ttyEnabled: true, command: 'cat')]) {
          node ('jenkpod') { container('golang') {
      
              stage('Pre-Build') {
                  sshagent (credentials: ['jenkins-master-ssh']) {
                      sh 'ssh -vT -o "StrictHostKeyChecking=no" git@github.com'
                  }
              }
      
          } }
      }
      

      fails with public key error:

      debug1: Authentications that can continue: publickey
      debug1: Next authentication method: publickey
      debug1: Trying private key: /root/.ssh/id_rsa
      debug1: Trying private key: /root/.ssh/id_dsa
      debug1: Trying private key: /root/.ssh/id_ecdsa
      debug1: Trying private key: /root/.ssh/id_ed25519
      debug1: No more authentication methods to try.
      Permission denied (publickey).

       

      this seems closely related to -JENKINS-32624 sshagent{} ignored when executed in docker.image().inside

       

          [JENKINS-42582] ssh-agent not applied in kubernetes container

          J Knurek created issue -
          J Knurek made changes -
          Link New: This issue is related to JENKINS-32624 [ JENKINS-32624 ]
          J Knurek made changes -
          Link New: This issue is related to JENKINS-42851 [ JENKINS-42851 ]
          J Knurek made changes -
          Link New: This issue is related to JENKINS-40647 [ JENKINS-40647 ]
          Carlos Sanchez made changes -
          Link New: This issue is blocked by JENKINS-47225 [ JENKINS-47225 ]
          Martin Sander made changes -
          Remote Link New: This issue links to "Pull request #236 (Web Link)" [ 17902 ]
          Martin Sander made changes -
          Assignee Original: Carlos Sanchez [ csanchez ] New: Matthew Ludlum [ seakip18 ]
          Martin Sander made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Martin Sander made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]
          Fran Garcia made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Resolved [ 5 ] New: Reopened [ 4 ]
          Jesse Glick made changes -
          Link New: This issue duplicates JENKINS-49370 [ JENKINS-49370 ]

            seakip18 Matthew Ludlum
            jknurek J Knurek
            Votes:
            6 Vote for this issue
            Watchers:
            23 Start watching this issue

              Created:
              Updated:
              Resolved: