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

Docker Workflow demos: sh step on Docker image hangs if workspace is not writable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Blocker Blocker
    • docker-workflow-plugin
    • remote docker server
      docker-workflow-1.0

      A sample demo workflow script hangs infinitely on the shell step.
      Logs are available below, stackdump is attached.

      Workflow:

      docker.image('maven:3.3.3-jdk-8').inside {
        git url: "https://github.com/oleg-nenashev/ircbot.git"
        sh 'echo hello'
        //Same thing with mvn -B clean install'
      }
      

      Build log

      Started by user anonymous
      Running: Allocate node : Start
      Running on master in /Users/nenashev/Documents/cloudbees/demo/docker-traceability/work/jobs/test-example-1/workspace
      Running: Allocate node : Body : Start
      Running: Shell Script
      [workspace] Running shell script
      + docker inspect -f . maven:3.3.3-jdk-8
      .
      Running: Run build steps inside a Docker container : Start
      $ docker run -t -d -u 502:20 -w /Users/nenashev/Documents/cloudbees/demo/docker-traceability/work/jobs/test-example-1/workspace -v /Users/nenashev/Documents/cloudbees/demo/docker-traceability/work/jobs/test-example-1/workspace:/Users/nenashev/Documents/cloudbees/demo/docker-traceability/work/jobs/test-example-1/workspace:rw -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** -e ******** maven:3.3.3-jdk-8 cat
      Running: Run build steps inside a Docker container : Body : Start
      Running: Git
       > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
       > git config remote.origin.url https://github.com/oleg-nenashev/ircbot.git # timeout=10
      Fetching upstream changes from https://github.com/oleg-nenashev/ircbot.git
       > git --version # timeout=10
       > git -c core.askpass=true fetch --tags --progress https://github.com/oleg-nenashev/ircbot.git +refs/heads/*:refs/remotes/origin/*
       > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
       > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
      Checking out Revision eaa8c349f12288276e5c27fcef78c245bb41517a (refs/remotes/origin/master)
       > git config core.sparsecheckout # timeout=10
       > git checkout -f eaa8c349f12288276e5c27fcef78c245bb41517a
       > git rev-list eaa8c349f12288276e5c27fcef78c245bb41517a # timeout=10
      Running: Shell Script
      [workspace] Running shell script
      <<< hangs here
      

          [JENKINS-28821] Docker Workflow demos: sh step on Docker image hangs if workspace is not writable

          Oleg Nenashev created issue -
          Oleg Nenashev made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]

          Oleg Nenashev added a comment -

          Proposed solution: at least fail the build if the workspace is not writable, docker does not fail on binding issues

          Oleg Nenashev added a comment - Proposed solution: at least fail the build if the workspace is not writable, docker does not fail on binding issues
          Oleg Nenashev made changes -
          Link New: This issue is related to JENKINS-28400 [ JENKINS-28400 ]

          Greg Symons added a comment -

          This problem occurs even when using a local docker via socket. See the example below:

          docker.image('java:openjdk-7-jre').inside {
            sh 'java -version'
          }
          

          Greg Symons added a comment - This problem occurs even when using a local docker via socket. See the example below: docker.image( 'java:openjdk-7-jre' ).inside { sh 'java -version' }

          Oleg Nenashev added a comment -

          CCed jglick]

          Oleg Nenashev added a comment - CCed jglick ]

          Greg Symons added a comment -

          It looks like my problem was a non-writable workspace as well. I fixed that, and now shell tasks no longer hang.

          Greg Symons added a comment - It looks like my problem was a non-writable workspace as well. I fixed that, and now shell tasks no longer hang.
          Jesse Glick made changes -
          Remote Link New: This issue links to "PR 7 (Web Link)" [ 13101 ]
          Oleg Nenashev made changes -
          Assignee Original: Oleg Nenashev [ oleg_nenashev ] New: Jesse Glick [ jglick ]
          Oleg Nenashev made changes -
          Assignee Original: Jesse Glick [ jglick ]

            Unassigned Unassigned
            oleg_nenashev Oleg Nenashev
            Votes:
            3 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: