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

bat calls hang in Windows Docker container in declarative pipeline script

      Description

      bat steps hang (endless spinning wheel in the jobs console output) even for simple Windows containers.

      bat "echo test inside"

      Troubleshooting & Additional info

      powershell and all other commands tried so far work without issue. Even using powershell to wrap cmd.exe commands works fine. Example:

       

      powershell "cmd /c echo test inside"

       

      Running the image manually on the node host exhibits no issues. i.e. can run docker run -it microsoft/windowsservercore:ltsc2016 and happy use cmd and all other commands without issue.

      Similarly we can attach to the container spun up by the Jenkins job while it's hung and execute the same echo command (or any other) without issue.

      Others have not had this issue so it could be something specific in our setup, but I have not been able to pinpoint anything. https://github.com/jenkinsci/docker-workflow-plugin/pull/184#issuecomment-539213785

      The job console output shows no errors and neither does the main Jenkins log under /log/all. No errors if any kind while the job is running / hung.

      Setup

      Jenkins node host: Windows Server 2016 (1607)

      Docker image: microsoft/windowsservercore:ltsc2016

      Happens regardless if docker {} or dockerfile {} syntax is used.

      Specifically using declarative pipeline scripts. Have not tested other methods

      pipeline {
          agent {
              docker {
                  image 'microsoft/windowsservercore:ltsc2016'
                  label 'windows'
              }
          }
          stages {
              stage('Example Build') {
                  steps{
                      bat "echo test inside"
                  }
              }
          }
      }

          [JENKINS-59893] bat calls hang in Windows Docker container in declarative pipeline script

          a b created issue -
          a b made changes -
          Description Original: h3. Description

          {{bat}} steps hang (endless spinning wheel in the jobs console output) even for simple Windows containers.
          h3. Troubleshooting & Additional info

          powershell and all other commands tried so far work without issue. Even using powershell to wrap cmd.exe commands works fine. Example:

           
          {code:java}
          powershell "cmd /c echo test inside"{code}
           

          Running the image manually on the node host exhibits no issues. i.e. can run docker run -it microsoft/windowsservercore:ltsc2016 and happy use cmd and all other commands without issue.

          Similarly we can attach to the container spun up by the Jenkins job while it's hung and execute the same echo command (or any other) without issue.

          Others have not had this issue so it could be something specific in our setup, but I have not been able to pinpoint anything. [https://github.com/jenkinsci/docker-workflow-plugin/pull/184#issuecomment-539213785]

          The job console output shows no errors and neither does the main Jenkins log under /log/all. No errors if any kind while the job is running / hung.
          h3. Setup

          Jenkins node host: {{Windows Server 2016 (1607)}}

          Docker image: {{microsoft/windowsservercore:ltsc2016}}

          Happens regardless if {{docker {}}} or {{dockerfile {}}} syntax is used.
          {code:java}
          pipeline {
              agent {
                  docker {
                      image 'microsoft/windowsservercore:ltsc2016'
                      label 'windows'
                  }
              }
              stages {
                  stage('Example Build') {
                      steps{
                          bat "echo test inside"
                      }
                  }
              }
          }{code}
          New: h3. Description

          {{bat}} steps hang (endless spinning wheel in the jobs console output) even for simple Windows containers.
           bat "echo test inside"
          h3. Troubleshooting & Additional info

          powershell and all other commands tried so far work without issue. Even using powershell to wrap cmd.exe commands works fine. Example:

           
          {code:java}
          powershell "cmd /c echo test inside"{code}
           

          Running the image manually on the node host exhibits no issues. i.e. can run docker run -it microsoft/windowsservercore:ltsc2016 and happy use cmd and all other commands without issue.

          Similarly we can attach to the container spun up by the Jenkins job while it's hung and execute the same echo command (or any other) without issue.

          Others have not had this issue so it could be something specific in our setup, but I have not been able to pinpoint anything. [https://github.com/jenkinsci/docker-workflow-plugin/pull/184#issuecomment-539213785]

          The job console output shows no errors and neither does the main Jenkins log under /log/all. No errors if any kind while the job is running / hung.
          h3. Setup

          Jenkins node host: {{Windows Server 2016 (1607)}}

          Docker image: {{microsoft/windowsservercore:ltsc2016}}

          Happens regardless if {{docker {}}} or {{dockerfile {}}} syntax is used.
          {code:java}
          pipeline {
              agent {
                  docker {
                      image 'microsoft/windowsservercore:ltsc2016'
                      label 'windows'
                  }
              }
              stages {
                  stage('Example Build') {
                      steps{
                          bat "echo test inside"
                      }
                  }
              }
          }{code}
          a b made changes -
          Description Original: h3. Description

          {{bat}} steps hang (endless spinning wheel in the jobs console output) even for simple Windows containers.
           bat "echo test inside"
          h3. Troubleshooting & Additional info

          powershell and all other commands tried so far work without issue. Even using powershell to wrap cmd.exe commands works fine. Example:

           
          {code:java}
          powershell "cmd /c echo test inside"{code}
           

          Running the image manually on the node host exhibits no issues. i.e. can run docker run -it microsoft/windowsservercore:ltsc2016 and happy use cmd and all other commands without issue.

          Similarly we can attach to the container spun up by the Jenkins job while it's hung and execute the same echo command (or any other) without issue.

          Others have not had this issue so it could be something specific in our setup, but I have not been able to pinpoint anything. [https://github.com/jenkinsci/docker-workflow-plugin/pull/184#issuecomment-539213785]

          The job console output shows no errors and neither does the main Jenkins log under /log/all. No errors if any kind while the job is running / hung.
          h3. Setup

          Jenkins node host: {{Windows Server 2016 (1607)}}

          Docker image: {{microsoft/windowsservercore:ltsc2016}}

          Happens regardless if {{docker {}}} or {{dockerfile {}}} syntax is used.
          {code:java}
          pipeline {
              agent {
                  docker {
                      image 'microsoft/windowsservercore:ltsc2016'
                      label 'windows'
                  }
              }
              stages {
                  stage('Example Build') {
                      steps{
                          bat "echo test inside"
                      }
                  }
              }
          }{code}
          New: h3. Description

          {{bat}} steps hang (endless spinning wheel in the jobs console output) even for simple Windows containers.

           
           bat "echo test inside"
          h3. Troubleshooting & Additional info

          powershell and all other commands tried so far work without issue. Even using powershell to wrap cmd.exe commands works fine. Example:

           
          {code:java}
          powershell "cmd /c echo test inside"{code}
           

          Running the image manually on the node host exhibits no issues. i.e. can run docker run -it microsoft/windowsservercore:ltsc2016 and happy use cmd and all other commands without issue.

          Similarly we can attach to the container spun up by the Jenkins job while it's hung and execute the same echo command (or any other) without issue.

          Others have not had this issue so it could be something specific in our setup, but I have not been able to pinpoint anything. [https://github.com/jenkinsci/docker-workflow-plugin/pull/184#issuecomment-539213785]

          The job console output shows no errors and neither does the main Jenkins log under /log/all. No errors if any kind while the job is running / hung.
          h3. Setup

          Jenkins node host: {{Windows Server 2016 (1607)}}

          Docker image: {{microsoft/windowsservercore:ltsc2016}}

          Happens regardless if {{docker {}}} or {{dockerfile {}}} syntax is used.
          {code:java}
          pipeline {
              agent {
                  docker {
                      image 'microsoft/windowsservercore:ltsc2016'
                      label 'windows'
                  }
              }
              stages {
                  stage('Example Build') {
                      steps{
                          bat "echo test inside"
                      }
                  }
              }
          }{code}
          a b made changes -
          Description Original: h3. Description

          {{bat}} steps hang (endless spinning wheel in the jobs console output) even for simple Windows containers.

           
           bat "echo test inside"
          h3. Troubleshooting & Additional info

          powershell and all other commands tried so far work without issue. Even using powershell to wrap cmd.exe commands works fine. Example:

           
          {code:java}
          powershell "cmd /c echo test inside"{code}
           

          Running the image manually on the node host exhibits no issues. i.e. can run docker run -it microsoft/windowsservercore:ltsc2016 and happy use cmd and all other commands without issue.

          Similarly we can attach to the container spun up by the Jenkins job while it's hung and execute the same echo command (or any other) without issue.

          Others have not had this issue so it could be something specific in our setup, but I have not been able to pinpoint anything. [https://github.com/jenkinsci/docker-workflow-plugin/pull/184#issuecomment-539213785]

          The job console output shows no errors and neither does the main Jenkins log under /log/all. No errors if any kind while the job is running / hung.
          h3. Setup

          Jenkins node host: {{Windows Server 2016 (1607)}}

          Docker image: {{microsoft/windowsservercore:ltsc2016}}

          Happens regardless if {{docker {}}} or {{dockerfile {}}} syntax is used.
          {code:java}
          pipeline {
              agent {
                  docker {
                      image 'microsoft/windowsservercore:ltsc2016'
                      label 'windows'
                  }
              }
              stages {
                  stage('Example Build') {
                      steps{
                          bat "echo test inside"
                      }
                  }
              }
          }{code}
          New: h3. Description

          {{bat}} steps hang (endless spinning wheel in the jobs console output) even for simple Windows containers.
          {code:java}
          bat "echo test inside"{code}
          h3. Troubleshooting & Additional info

          powershell and all other commands tried so far work without issue. Even using powershell to wrap cmd.exe commands works fine. Example:

           
          {code:java}
          powershell "cmd /c echo test inside"{code}
           

          Running the image manually on the node host exhibits no issues. i.e. can run docker run -it microsoft/windowsservercore:ltsc2016 and happy use cmd and all other commands without issue.

          Similarly we can attach to the container spun up by the Jenkins job while it's hung and execute the same echo command (or any other) without issue.

          Others have not had this issue so it could be something specific in our setup, but I have not been able to pinpoint anything. [https://github.com/jenkinsci/docker-workflow-plugin/pull/184#issuecomment-539213785]

          The job console output shows no errors and neither does the main Jenkins log under /log/all. No errors if any kind while the job is running / hung.
          h3. Setup

          Jenkins node host: {{Windows Server 2016 (1607)}}

          Docker image: {{microsoft/windowsservercore:ltsc2016}}

          Happens regardless if {{docker {}}} or {{dockerfile {}}} syntax is used.
          {code:java}
          pipeline {
              agent {
                  docker {
                      image 'microsoft/windowsservercore:ltsc2016'
                      label 'windows'
                  }
              }
              stages {
                  stage('Example Build') {
                      steps{
                          bat "echo test inside"
                      }
                  }
              }
          }{code}
          a b made changes -
          Summary Original: bat calls hang in Windows Docker container New: bat calls hang in Windows Docker container in pipeline script
          a b made changes -
          Summary Original: bat calls hang in Windows Docker container in pipeline script New: bat calls hang in Windows Docker container in declarative pipeline script
          a b made changes -
          Description Original: h3. Description

          {{bat}} steps hang (endless spinning wheel in the jobs console output) even for simple Windows containers.
          {code:java}
          bat "echo test inside"{code}
          h3. Troubleshooting & Additional info

          powershell and all other commands tried so far work without issue. Even using powershell to wrap cmd.exe commands works fine. Example:

           
          {code:java}
          powershell "cmd /c echo test inside"{code}
           

          Running the image manually on the node host exhibits no issues. i.e. can run docker run -it microsoft/windowsservercore:ltsc2016 and happy use cmd and all other commands without issue.

          Similarly we can attach to the container spun up by the Jenkins job while it's hung and execute the same echo command (or any other) without issue.

          Others have not had this issue so it could be something specific in our setup, but I have not been able to pinpoint anything. [https://github.com/jenkinsci/docker-workflow-plugin/pull/184#issuecomment-539213785]

          The job console output shows no errors and neither does the main Jenkins log under /log/all. No errors if any kind while the job is running / hung.
          h3. Setup

          Jenkins node host: {{Windows Server 2016 (1607)}}

          Docker image: {{microsoft/windowsservercore:ltsc2016}}

          Happens regardless if {{docker {}}} or {{dockerfile {}}} syntax is used.
          {code:java}
          pipeline {
              agent {
                  docker {
                      image 'microsoft/windowsservercore:ltsc2016'
                      label 'windows'
                  }
              }
              stages {
                  stage('Example Build') {
                      steps{
                          bat "echo test inside"
                      }
                  }
              }
          }{code}
          New: h3. Description

          {{bat}} steps hang (endless spinning wheel in the jobs console output) even for simple Windows containers.
          {code:java}
          bat "echo test inside"{code}
          h3. Troubleshooting & Additional info

          powershell and all other commands tried so far work without issue. Even using powershell to wrap cmd.exe commands works fine. Example:

           
          {code:java}
          powershell "cmd /c echo test inside"{code}
           

          Running the image manually on the node host exhibits no issues. i.e. can run docker run -it microsoft/windowsservercore:ltsc2016 and happy use cmd and all other commands without issue.

          Similarly we can attach to the container spun up by the Jenkins job while it's hung and execute the same echo command (or any other) without issue.

          Others have not had this issue so it could be something specific in our setup, but I have not been able to pinpoint anything. [https://github.com/jenkinsci/docker-workflow-plugin/pull/184#issuecomment-539213785]

          The job console output shows no errors and neither does the main Jenkins log under /log/all. No errors if any kind while the job is running / hung.
          h3. Setup

          Jenkins node host: {{Windows Server 2016 (1607)}}

          Docker image: {{microsoft/windowsservercore:ltsc2016}}

          Happens regardless if {{docker {}}} or {{dockerfile {}}} syntax is used.

          Specifically using declarative pipeline scripts. Have not tested other methods
          {code:java}
          pipeline {
              agent {
                  docker {
                      image 'microsoft/windowsservercore:ltsc2016'
                      label 'windows'
                  }
              }
              stages {
                  stage('Example Build') {
                      steps{
                          bat "echo test inside"
                      }
                  }
              }
          }{code}

          Henry Borchers added a comment - - edited

          I'm also having this problem. However it's hanging on powershell as well.

          Edit: typo

          Henry Borchers added a comment - - edited I'm also having this problem. However it's hanging on powershell as well. Edit: typo

          a b added a comment -

          What host OS and Docker images are you using?

          a b added a comment - What host OS and Docker images are you using?

          stuck_tech

          Host OS:, Windows Server 2019 

          Docker images tried:

          • mcr.microsoft.com/windows/servercore:ltsc2019
          • mcr.microsoft.com/powershell:preview
          • One of my own based off of  mcr.microsoft.com/dotnet/framework/sdk:3.5

          Same experience on every one. 

           

          Currently my test pipeline looks like. this

           

          pipeline {  
              agent any  
              stages {
                  stage('hello world') {
                      parallel {
                          // this one doesn't work
                          stage('Hello world on Windows') {
                              agent {
                                docker {
                                    label 'Windows&&Docker&&aws'
                                    image 'mcr.microsoft.com/windows/servercore:ltsc2019'
                                }
                               }
                              options {
                               timeout(1) // in case the pipeline hangs
                              }
                              steps {
                               // hangs here
                               powershell 'powershell "cmd /c echo test inside"'
                              }
                          }
                          // This one works just fine
                          stage('Hello world on Linux') {
                              agent {
                                docker {
                                    label 'linux&&docker&&aws'
                                    image 'alpine:latest'
                                }
                              }
                              options {
                               timeout(1) // in case the pipeline hangs
                              }
                              steps {
                               sh 'echo "hello world"'
                              }
                          }
                }
              }
            }
          }
          

           

           

          Henry Borchers added a comment - stuck_tech Host OS:, Windows Server 2019  Docker images tried: mcr.microsoft.com/windows/servercore:ltsc2019 mcr.microsoft.com/powershell:preview One of my own based off of  mcr.microsoft.com/dotnet/framework/sdk:3.5 Same experience on every one.    Currently my test pipeline looks like. this   pipeline { agent any stages { stage( 'hello world' ) { parallel { // this one doesn't work stage( 'Hello world on Windows' ) { agent { docker { label 'Windows&&Docker&&aws' image 'mcr.microsoft.com/windows/servercore:ltsc2019' } } options { timeout(1) // in case the pipeline hangs } steps { // hangs here powershell 'powershell "cmd /c echo test inside" ' } } // This one works just fine stage( 'Hello world on Linux' ) { agent { docker { label 'linux&&docker&&aws' image 'alpine:latest' } } options { timeout(1) // in case the pipeline hangs } steps { sh 'echo "hello world" ' } } } } } }    

            Unassigned Unassigned
            stuck_tech a b
            Votes:
            4 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: