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

SSH_AUTH_SOCK file not created

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • Jenkins 2.27
      CloudBees Docker Custom Build Environment Plugin 1.6.5
      SSH Agent Plugin 1.13
      Ubuntu 14.04.4 master
      Ubuntu 14.04.1 slave host
      Ubuntu xenial docker image

      I use `ssh-agent` within a docker (through the https://wiki.jenkins-ci.org/display/JENKINS/CloudBees+Docker+Pipeline+Plugin plugin). From the logs, the ssh-agent appears to start and load the proper credentials.

      However, if I were to use the credentials, those would not work at all. If I inspect the environment, I see that the `SSH_AUTH_SOCK` variable is set, however, if I inspect the content of the /tmp directory, there is no such file created.

      I thought it might have been permission related so I tried creating a plain file and a pipe file in the directory, both operations worked.

      Finally, I checked if the socket was created on the slave (and not within the docker container). That does not appear to be the case. Furthermore, the environment variable is only available within the container.

      [Pipeline] sh
      11:45:20 [erator_features_jenkinsfile-G73UMTC4PC2ORV4UVNKTVOX3CD5I3WJUAZ4B2XZFZ35UFR44XOOQ] Running shell script
      11:45:21 + docker inspect -f . -stripped-/jenkins-slave
      11:45:21 .
      [Pipeline] withDockerContainer
      11:45:21 $ docker run -t -d -u 1001:1001 -w /home/jenkins/workspace/erator_features_jenkinsfile-G73UMTC4PC2ORV4UVNKTVOX3CD5I3WJUAZ4B2XZFZ35UFR44XOOQ -v /home/jenkins/workspace/erator_features_jenkinsfile-G73UMTC4PC2ORV4UVNKTVOX3CD5I3WJUAZ4B2XZFZ35UFR44XOOQ:/home/jenkins/workspace/erator_features_jenkinsfile-G73UMTC4PC2ORV4UVNKTVOX3CD5I3WJUAZ4B2XZFZ35UFR44XOOQ:rw -v /home/jenkins/workspace/erator_features_jenkinsfile-G73UMTC4PC2ORV4UVNKTVOX3CD5I3WJUAZ4B2XZFZ35UFR44XOOQ@tmp:/home/jenkins/workspace/erator_features_jenkinsfile-G73UMTC4PC2ORV4UVNKTVOX3CD5I3WJUAZ4B2XZFZ35UFR44XOOQ@tmp:rw -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** --entrypoint cat -stripped-/jenkins-slave
      [... checkout ...]
      [Pipeline] sshagent
      11:45:22 [ssh-agent] Using credentials bot
      11:45:22 [ssh-agent] Looking for ssh-agent implementation...
      11:45:22 [ssh-agent]   Java/JNR ssh-agent
      11:45:22 [ssh-agent] Registered BouncyCastle on the remote agent
      11:45:22 [ssh-agent] Started.
      [Pipeline] {
      [Pipeline] sh
      11:45:22 [erator_features_jenkinsfile-G73UMTC4PC2ORV4UVNKTVOX3CD5I3WJUAZ4B2XZFZ35UFR44XOOQ] Running shell script
      11:45:22 + ls -l /tmp
      11:45:22 total 0
      [Pipeline] sh
      11:45:22 [erator_features_jenkinsfile-G73UMTC4PC2ORV4UVNKTVOX3CD5I3WJUAZ4B2XZFZ35UFR44XOOQ] Running shell script
      11:45:23 + env
      11:45:23 JENKINS_HOME=/var/lib/jenkins
      11:45:23 HOSTNAME=328078553d6b
      11:45:23 HUDSON_URL=https://-stripped-/
      11:45:23 NODE_LABELS=nodename docker
      11:45:23 HOME=/home/jenkins
      11:45:23 BUILD_URL=https://-stripped-/job/-stripped-/job/features%252Fjenkinsfile/14/
      11:45:23 JENKINS_SERVER_COOKIE=durable-c6382323f4ca85fd7500f801a6d2f47a
      11:45:23 WORKSPACE=/home/jenkins/workspace/erator_features_jenkinsfile-G73UMTC4PC2ORV4UVNKTVOX3CD5I3WJUAZ4B2XZFZ35UFR44XOOQ
      11:45:23 NODE_NAME=nodename
      11:45:23 EXECUTOR_NUMBER=6
      11:45:23 TERM=xterm
      11:45:23 BUILD_DISPLAY_NAME=#14
      11:45:23 HUDSON_HOME=/var/lib/jenkins
      11:45:23 JOB_BASE_NAME=features%2Fjenkinsfile
      11:45:23 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
      11:45:23 BUILD_ID=14
      11:45:23 BUILD_TAG=jenkins--stripped--features%2Fjenkinsfile-14
      11:45:23 JENKINS_URL=https://-stripped-/
      11:45:23 JOB_URL=https://-stripped-/job/-stripped-/job/features%252Fjenkinsfile/
      11:45:23 BUILD_NUMBER=14
      11:45:23 SSH_AUTH_SOCK=/tmp/ssh6907962264659032179
      11:45:23 HUDSON_SERVER_COOKIE=ac57948fc0430f35
      11:45:23 CLASSPATH=
      11:45:23 JOB_NAME=-stripped-/features%2Fjenkinsfile
      11:45:23 PWD=/home/jenkins/workspace/erator_features_jenkinsfile-G73UMTC4PC2ORV4UVNKTVOX3CD5I3WJUAZ4B2XZFZ35UFR44XOOQ
      11:45:23 BRANCH_NAME=features/jenkinsfile
      11:45:23 [erator_features_jenkinsfile-G73UMTC4PC2ORV4UVNKTVOX3CD5I3WJUAZ4B2XZFZ35UFR44XOOQ] Running shell script
      11:45:23 + touch /tmp/test
      [Pipeline] sh
      11:45:23 [erator_features_jenkinsfile-G73UMTC4PC2ORV4UVNKTVOX3CD5I3WJUAZ4B2XZFZ35UFR44XOOQ] Running shell script
      11:45:23 + mkfifo /tmp/fifo
      [Pipeline] sh
      11:45:23 [erator_features_jenkinsfile-G73UMTC4PC2ORV4UVNKTVOX3CD5I3WJUAZ4B2XZFZ35UFR44XOOQ] Running shell script
      11:45:23 + ls -l /tmp
      11:45:23 total 0
      11:45:23 prw-r--r-- 1 jenkins jenkins 0 Nov  6 16:45 fifo
      11:45:23 -rw-r--r-- 1 jenkins jenkins 0 Nov  6 16:45 test
      

            ndeloof Nicolas De Loof
            tomzx Tom R
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: