Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-43050

SSH Agent plugin doesn't work well with docker pipelines

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • ssh-agent-plugin
    • None

      I've tried

      dockerImage.inside {
        sshagent([...]) {
          sh '...'
        }
      }
      

      and this appears to fail because the ssh-agent gets launched but then the next command
      appears to be ssh-agent -k which kills the process before the sh step has a chance to run despite the sh command being inside the sshagent block.

      And also

      sshagent([...]){
        dockerImage.inside {
          sh '...'
        }
      }
      

      fails (I think) for a more predictable reason: the ssh-agent stays running and the env variables get
      set correctly inside the container, however the socket is in /tmp on the container server which is not visible to the container (by default).

          [JENKINS-43050] SSH Agent plugin doesn't work well with docker pipelines

          Erik Lattimore created issue -

          Jesse Glick added a comment -

          sshagent must indeed be inside inside.

          Not sure how to reproduce. It works for me.

          Jesse Glick added a comment - sshagent must indeed be inside inside . Not sure how to reproduce. It works for me.
          Jesse Glick made changes -
          Link New: This issue blocks JENKINS-36997 [ JENKINS-36997 ]

          Hmm, you're right. I am now unable to reproduce the issue I was having.

          Erik Lattimore added a comment - Hmm, you're right. I am now unable to reproduce the issue I was having.
          Erik Lattimore made changes -
          Resolution New: Cannot Reproduce [ 5 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]

          Jesse Glick added a comment -

          If you have complete, minimal, self-contained steps to reproduce the issue from scratch, please add them here and reopen.

          Jesse Glick added a comment - If you have complete, minimal, self-contained steps to reproduce the issue from scratch, please add them here and reopen.
          Ihor Sviziev made changes -
          Status Original: Closed [ 6 ] New: In Review [ 10005 ]
          Ihor Sviziev made changes -
          Status Original: In Review [ 10005 ] New: In Progress [ 3 ]
          Ihor Sviziev made changes -
          Resolution Original: Cannot Reproduce [ 5 ]
          Status Original: In Progress [ 3 ] New: Open [ 1 ]

          Jesse Glick added a comment -

          Not sure offhand, would have to spend time digging into it. The obvious workaround is to just not use the SSH Agent plugin, and run ssh-agent yourself. You are probably better off not using Docker Pipeline either; just write a Dockerfile that sets things up the way you need it.

          Jesse Glick added a comment - Not sure offhand, would have to spend time digging into it. The obvious workaround is to just not use the SSH Agent plugin, and run ssh-agent yourself. You are probably better off not using Docker Pipeline either; just write a Dockerfile that sets things up the way you need it.

            Unassigned Unassigned
            elatt Erik Lattimore
            Votes:
            3 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated: