docker pipeline hangs when global environment variable contains path with spaces

This issue is archived. You can view it, but you can't modify it. Learn more

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.

       

            Assignee:
            Paul "TBBle" Hampson
            Reporter:
            Ben
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: