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

Durable task plugin on Windows fails to run jenkins-wrapper.bat if workspace has a space

      If the path to the Jenkins workspace folder has a space in Windows the space is not properly handled when launching a Windows docker container with the docker workflow plugin.

      Docker Desktop Version: 27.2.0
      Image: mcr.microsoft.com/windows/nanoserver:ltsc2019

      This can be reproduced by running docker for windows through a unit test.

      Command:

      docker exec --workdir C:\git\docker-workflow-plugin\target\tmp\j h14592559048553421565\workspace\prj <. . .> 98037c1c32a7ca4b27e54256097b8d3c45e5629581921e606e1bbe6204b02bc9 cmd /c ""C:\git\docker-workflow-plugin\target\tmp\j h14592559048553421565\workspace\prj@tmp\durable-33850330\jenkins-wrap.bat""
      

      Response:

      'C:\git\docker-workflow-plugin\target\tmp\j\' is not recognized as an internal or external command,
      operable program or batch file.
      

      There are two defects here:
      1) The workdir needs to be quoted here
      2) The consecutive double quotes ("") used when launching jenkins-wrapper.bat doesn't work with docker exec here

      After experimenting it looks like the "cmd /c call" approach already used by the jenkins-wraper.bat works:

      docker exec --workdir C:\git\docker-workflow-plugin\target\tmp\j h14592559048553421565\workspace\prj <. . .> 98037c1c32a7ca4b27e54256097b8d3c45e5629581921e606e1bbe6204b02bc9 cmd /c call "C:\git\docker-workflow-plugin\target\tmp\j h14592559048553421565\workspace\prj@tmp\durable-33850330\jenkins-wrap.bat"
      

          [JENKINS-75102] Durable task plugin on Windows fails to run jenkins-wrapper.bat if workspace has a space

          Mark R created issue -
          Mark R made changes -
          Link New: This issue relates to JENKINS-74912 [ JENKINS-74912 ]
          Mark R made changes -
          Description Original: If the path to the Jenkins workspace folder has a space in Windows the space is not properly handled when launching a Windows docker container with the docker workflow plugin.

          Docker Desktop Version: 27.2.0
          Image: mcr.microsoft.com/windows/nanoserver:ltsc2019

          This can be reproduced by running docker for windows through a unit test.

          Command:
          {noformat}
          docker exec --workdir C:\git\docker-workflow-plugin\target\tmp\j h14592559048553421565\workspace\prj <. . .> 98037c1c32a7ca4b27e54256097b8d3c45e5629581921e606e1bbe6204b02bc9 cmd /c ""C:\git\docker-workflow-plugin\target\tmp\j h14592559048553421565\workspace\prj@tmp\durable-33850330\jenkins-wrap.bat""
          {noformat}

          Response:
          {noformat}
          'C:\git\docker-workflow-plugin\target\tmp\j\' is not recognized as an internal or external command,
          operable program or batch file.
          {noformat}


          There are two defects here:
          1) The workdir needs to be quoted [here|https://github.com/jenkinsci/docker-workflow-plugin/blob/master/src/main/java/org/jenkinsci/plugins/docker/workflow/WithContainerStep.java#L280]
          2) The consecutive double quotes ("") used when launching jenkins-wrapper.bat doesn't properly handle the space [here|https://github.com/jenkinsci/durable-task-plugin/blob/master/src/main/java/org/jenkinsci/plugins/durabletask/WindowsBatchScript.java#L157]

          After experimenting it looks like the "cmd /c call" approach already used by the jenkins-wraper.bat works:

          {noformat}
          docker exec --workdir C:\git\docker-workflow-plugin\target\tmp\j h14592559048553421565\workspace\prj <. . .> 98037c1c32a7ca4b27e54256097b8d3c45e5629581921e606e1bbe6204b02bc9 cmd /c call "C:\git\docker-workflow-plugin\target\tmp\j h14592559048553421565\workspace\prj@tmp\durable-33850330\jenkins-wrap.bat"
          {noformat}
          New: If the path to the Jenkins workspace folder has a space in Windows the space is not properly handled when launching a Windows docker container with the docker workflow plugin.

          Docker Desktop Version: 27.2.0
          Image: mcr.microsoft.com/windows/nanoserver:ltsc2019

          This can be reproduced by running docker for windows through a unit test.

          Command:
          {noformat}
          docker exec --workdir C:\git\docker-workflow-plugin\target\tmp\j h14592559048553421565\workspace\prj <. . .> 98037c1c32a7ca4b27e54256097b8d3c45e5629581921e606e1bbe6204b02bc9 cmd /c ""C:\git\docker-workflow-plugin\target\tmp\j h14592559048553421565\workspace\prj@tmp\durable-33850330\jenkins-wrap.bat""
          {noformat}

          Response:
          {noformat}
          'C:\git\docker-workflow-plugin\target\tmp\j\' is not recognized as an internal or external command,
          operable program or batch file.
          {noformat}


          There are two defects here:
          1) The workdir needs to be quoted [here|https://github.com/jenkinsci/docker-workflow-plugin/blob/master/src/main/java/org/jenkinsci/plugins/docker/workflow/WithContainerStep.java#L280]
          2) The consecutive double quotes ("") used when launching jenkins-wrapper.bat doesn't work with docker exec [here|https://github.com/jenkinsci/durable-task-plugin/blob/master/src/main/java/org/jenkinsci/plugins/durabletask/WindowsBatchScript.java#L157]

          After experimenting it looks like the "cmd /c call" approach already used by the jenkins-wraper.bat works:

          {noformat}
          docker exec --workdir C:\git\docker-workflow-plugin\target\tmp\j h14592559048553421565\workspace\prj <. . .> 98037c1c32a7ca4b27e54256097b8d3c45e5629581921e606e1bbe6204b02bc9 cmd /c call "C:\git\docker-workflow-plugin\target\tmp\j h14592559048553421565\workspace\prj@tmp\durable-33850330\jenkins-wrap.bat"
          {noformat}
          Mark R made changes -
          Assignee New: Mark R [ mrichar2 ]
          Mark R made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Mark R made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Resolved [ 5 ]

            mrichar2 Mark R
            mrichar2 Mark R
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: