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

sshAgent {} inside docker.image().inside {} does not work with long project name

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • ssh-agent-plugin
    • None
    • Jenkins: 2.7.1 LTS
      docker-workflow-plugin: 1.7
      ssh-agent-plugin: 1.13

      If the socket can not be created in the tmp directory of the job, which happens if the socket path would get longer than 108, it will create the socket directly under /tmp. If I am using docker.image().inside this does not work. If I am using node {} it does work as expected.

      When using the GitHub Organisation Plugin I can not avoid long job names.

          [JENKINS-36997] sshAgent {} inside docker.image().inside {} does not work with long project name

          Stan Domula created issue -
          Stan Domula made changes -
          Priority Original: Minor [ 4 ] New: Major [ 3 ]
          Stan Domula made changes -
          Description Original: If the socket can not be created in the tmp directory of the job, which happens if the socket path would get longer than 108, it will create the socket directly under /tmp. If I am using docker.image().inside this does not work. If I am using node {} it does work as expected.
          New: If the socket can not be created in the tmp directory of the job, which happens if the socket path would get longer than 108, it will create the socket directly under /tmp. If I am using docker.image().inside this does not work. If I am using node {} it does work as expected.

          When using the GitHub Organisation Plugin I can not avoid long job names.

          Jesse Glick added a comment -

          Yes the SSH Agent plugin falls back to the system temporary directory when the path is going to be longer than 108 characters, the maximum typically supported by Linux kernels. Unfortunately this breaks the assumption of Docker Pipeline that the container and (agent) host share filesystems only in the workspace and its associated temporary directory.

          Might work to use ws with a (shortish) absolute path inside node but outside inside. Or use withCredentials to access the SSH private key explicitly rather than using sshAgent.

          Jesse Glick added a comment - Yes the SSH Agent plugin falls back to the system temporary directory when the path is going to be longer than 108 characters, the maximum typically supported by Linux kernels. Unfortunately this breaks the assumption of Docker Pipeline that the container and (agent) host share filesystems only in the workspace and its associated temporary directory. Might work to use ws with a (shortish) absolute path inside node but outside inside . Or use withCredentials to access the SSH private key explicitly rather than using sshAgent .

          Shane McDonald added a comment - - edited

          I ran into this as well. I got around the issue by checking "Use custom child workspace" in my job config, and setting "Child Directory" to ${SHORT_COMBINATION}

          Shane McDonald added a comment - - edited I ran into this as well. I got around the issue by checking "Use custom child workspace" in my job config, and setting "Child Directory" to ${SHORT_COMBINATION}

          Jesse Glick added a comment -

          Avoid that workaround; use ws instead.

          Jesse Glick added a comment - Avoid that workaround; use ws instead.

          Interesting... Couple of questions:

          • Why should I avoid this?
          • What is ws?

          Shane McDonald added a comment - Interesting... Couple of questions: Why should I avoid this? What is ws ?

          Jesse Glick added a comment -

          Look at the documentation.

          Jesse Glick added a comment - Look at the documentation.

          Thanks for being so helpful.

          Shane McDonald added a comment - Thanks for being so helpful.

          Jesse Glick added a comment -

          Would perhaps be bypassed by PR 2, TBD.

          Jesse Glick added a comment - Would perhaps be bypassed by PR 2, TBD.
          Jesse Glick made changes -
          Remote Link New: This issue links to "ssh-agent PR 2 (Web Link)" [ 15029 ]

            jglick Jesse Glick
            sdomula Stan Domula
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: