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

Container tasks (ContainerExecDecorator) not starting on Windows pods

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Component/s: kubernetes-plugin
    • Environment:
    • Similar Issues:

      Description

      When attempting to run a command using either the `bat` or `powershell` commands inside a `container()` block, the resulting durable-task script wrapper created in the container is not being run.  I can exec into the container and run it manually, and the resulting output is picked up by Jenkins and the pipeline moves on.  Nothing in the Jenkins log indicates any kind issue trying to run the command.  Commands outside the container block run fine.  The following is the node block I have (nothing fancy):

      node(label) {
        try {
          notifySlack()
          def myRepo = checkout scm
          def gitCommit = myRepo.GIT_COMMIT
          def gitBranch = myRepo.GIT_BRANCH
      
          stage("hello windows") {
            bat "dir /a"
            container(name:'windows-1809') {
                println "really want to do a dir here..."
                bat "dir /w"
                bat "set"
            }
          }
        } catch (e) {
          currentBuild.result = 'FAILURE'
          throw e
        }
        finally {
          notifySlack(currentBuild.result)
          stage("cleanup") {
            print "all done!"
          }
        }
      }
      

        Attachments

          Activity

          sleerssen Scott Leerssen created issue -
          sleerssen Scott Leerssen made changes -
          Field Original Value New Value
          Description When attempting to run a command using either the `bat` or `powershell` commands inside a `container()` block, the resulting durable-task script wrapper created in the container is not being run.  I can exec into the container and run it manually, and the resulting output is picked up by Jenkins and the pipeline moves on.  Nothing the Jenkins log indicates any kind issue trying to run the command.  Commands outside the container block run fine.  The following is the node block I have (nothing fancy):


          {code:java}
          node(label) {
            try {
              notifySlack()
              def myRepo = checkout scm
              def gitCommit = myRepo.GIT_COMMIT
              def gitBranch = myRepo.GIT_BRANCH

              stage("hello windows") {
                bat "dir /a"
                container(name:'windows-1809') {
                    println "really want to do a dir here..."
                    bat "dir /w"
                    bat "set"
                }
              }
            } catch (e) {
              currentBuild.result = 'FAILURE'
              throw e
            }
            finally {
              notifySlack(currentBuild.result)
              stage("cleanup") {
                print "all done!"
              }
            }
          }
          {code}
          When attempting to run a command using either the `bat` or `powershell` commands inside a `container()` block, the resulting durable-task script wrapper created in the container is not being run.  I can exec into the container and run it manually, and the resulting output is picked up by Jenkins and the pipeline moves on.  Nothing in the Jenkins log indicates any kind issue trying to run the command.  Commands outside the container block run fine.  The following is the node block I have (nothing fancy):
          {code:java}
          node(label) {
            try {
              notifySlack()
              def myRepo = checkout scm
              def gitCommit = myRepo.GIT_COMMIT
              def gitBranch = myRepo.GIT_BRANCH

              stage("hello windows") {
                bat "dir /a"
                container(name:'windows-1809') {
                    println "really want to do a dir here..."
                    bat "dir /w"
                    bat "set"
                }
              }
            } catch (e) {
              currentBuild.result = 'FAILURE'
              throw e
            }
            finally {
              notifySlack(currentBuild.result)
              stage("cleanup") {
                print "all done!"
              }
            }
          }
          {code}
          Hide
          sleerssen Scott Leerssen added a comment -

          I updated our Kubernetes plugin to the latest (1.25.7) and the container execs now work as desired.

          Show
          sleerssen Scott Leerssen added a comment - I updated our Kubernetes plugin to the latest (1.25.7) and the container execs now work as desired.
          Hide
          sleerssen Scott Leerssen added a comment -

          Updated plugin to 1.25.7 and problem went away

          Show
          sleerssen Scott Leerssen added a comment - Updated plugin to 1.25.7 and problem went away
          sleerssen Scott Leerssen made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            sleerssen Scott Leerssen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: