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

Executing shell in a container with a custom workingDir times out

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • kubernetes-plugin
    • None
    • Kubernetes 1.15, Jenkins 2.189, kubernetes-plugin 1.18.1
    • 1.22.1

      Hi,

      when using a custom working dir for a specific container, the workspace is mounted under this workingdir.

      Unfortunately, when running a shell script within this container, it runs by default using the workspace used for the POD (home/jenkins/agent/workspace)

      launching [nohup, sh, -c, (pid=$$$$; { while [ \( -d /proc/$$pid -o \! -d /proc/$$$$ \) -a -d '/home/jenkins/agent/workspace/myjob_jenkins_agent@tmp/durable-f6c3edf2' -a \! -f '/home/jenkins/agent/workspace/myjob_jenkins_agent@tmp/durable-f6c3edf2/jenkins-result.txt' ]; do touch '/home/jenkins/agent/workspace/myjob_jenkins_agent@tmp/durable-f6c3edf2/jenkins-log.txt'; sleep 3; done } & jsc=durable-88384c7a8cc3f3d75dd32c12a311af37; JENKINS_SERVER_COOKIE=$$jsc 'sh' -xe '/home/jenkins/agent/workspace/myjob_jenkins_agent@tmp/durable-f6c3edf2/script.sh' > '/home/jenkins/agent/workspace/myjob_jenkins_agent@tmp/durable-f6c3edf2/jenkins-log.txt' 2>&1; echo $$? > '/home/jenkins/agent/workspace/myjob_jenkins_agent@tmp/durable-f6c3edf2/jenkins-result.txt.tmp'; mv '/home/jenkins/agent/workspace/myjob_jenkins_agent@tmp/durable-f6c3edf2/jenkins-result.txt.tmp' '/home/jenkins/agent/workspace/myjob_jenkins_agent@tmp/durable-f6c3edf2/jenkins-result.txt'; wait) >&- 2>&- &]
      

      The effect is that the shell script stalls the build and then times out.

      Use case to reproduce : https://github.com/hypnoce/kubernetes-plugin/commit/5382f88cfc7f8c1a65b4397b903d7f813cff5371

      There are several options to fix this.

      What do you think ?

      Thanks

          [JENKINS-58975] Executing shell in a container with a custom workingDir times out

          Francis JAC created issue -
          Vincent Latombe made changes -
          Remote Link New: This issue links to "PR #610 (Web Link)" [ 23800 ]
          Vincent Latombe made changes -
          Assignee New: Narayanan Singaram [ narayanan ]
          Vincent Latombe made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Vincent Latombe made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]
          Francis JAC made changes -
          Comment [ This Jira is a regression. It used to work on the 1.17.3 version. ]
          Vincent Latombe made changes -
          Released As New: 1.22.1
          Resolution New: Fixed [ 1 ]
          Status Original: In Review [ 10005 ] New: Resolved [ 5 ]
          Vincent Latombe made changes -
          Link New: This issue causes JENKINS-60517 [ JENKINS-60517 ]
          Vincent Latombe made changes -
          Link New: This issue is duplicated by JENKINS-44030 [ JENKINS-44030 ]

            narayanan Narayanan Singaram
            hypnoce Francis JAC
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: