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

docker pipeline hangs when global environment variable contains path with spaces

XMLWordPrintable

      We've been trying to get scripted pipelines to run steps inside docker images for a while now. Steps like bat, powershell, pswh, etc. would cause the build to hang.

      After a lot of investigation the issue is soo easy to reproduce!
      In Jenkins under "Configure System" > "Global properties" > "Environment variables" we had a variable that contained quotes and a space. Example: "C:\Program Files\Red Gate\SmartAssembly 7\SmartAssembly.com"

      Here's a snippet from our Jenkinsfile:

       

      stage('build') {
          echo "On agent"
          docker.build("${appName}:${env.BUILD_ID}").inside {
              echo "In docker"
              bat 'echo running inside docker' // This will hang the build
          }
      }
      

      (Note: Using docker.image had the same result.)

      Removing the environment variable resolves the issue.

       

            p_hampson Paul "TBBle" Hampson
            benbarth Ben
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: