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

Unable to run a bat step if the double-quoted path argument contains whitespace

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      I run Jenkins 2.0 beta binary under Windows 10.
      Following tutorial in https://github.com/jenkinsci/workflow-plugin/blob/master/TUTORIAL.md,
      I created a pipeline job with the following script:

      node {
        git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'
        def mvnHome = tool 'M3'
        bat "${mvnHome}\\bin\\mvn -B verify"
      }
      

      I get the following error when running the job:

      Started by user Administrateur
      [Pipeline] Allocate node : Start
      Running on master in C:\Program Files (x86)\Jenkins\workspace\myPipeline
      [Pipeline] node {
      [Pipeline] git
      Cloning the remote Git repository
      remote: Counting objects
      Receiving objects
      Resolving deltas
      Updating references
      Checking out Revision 7dac409d4bd2fec35a4ccde0cb424042cba671df (refs/remotes/origin/master)
      First time build. Skipping changelog.
      [Pipeline] tool
      Unpacking http://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip to C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\M3 on Jenkins
      [Pipeline] bat
      [myPipeline] Running batch script
      
      C:\Program Files (x86)\Jenkins\workspace\myPipeline>C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\M3\bin\mvn -B verify 
      'C:\Program' is not recognized as internal or external command, an executable program or a commands file.
      [Pipeline] } //node
      [Pipeline] Allocate node : End
      [Pipeline] End of Pipeline
      ERROR: script returned exit code 1
      Finished: FAILURE
      

      Workaround: I have to surround ${mvnHome} reference between escaped double quote:

      node {
        git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'
        def mvnHome = tool 'M3'
        bat "\"${mvnHome}\"\\bin\\mvn -B verify"
      }
      

        Attachments

          Activity

          lautou Laurent TOURREAU created issue -
          lautou Laurent TOURREAU made changes -
          Field Original Value New Value
          Description I run Jenkins 2.0 beta binary under Windows 10.
          Following tutorial in https://github.com/jenkinsci/workflow-plugin/blob/master/TUTORIAL.md,
          I created a pipeline job with the following script:
          {code}
          node {
            git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'
            def mvnHome = tool 'M3'
            bat "${mvnHome}\\bin\\mvn -B verify"
          }
          {code}
          I get the following error when running the job:
          {code}
          Started by user Administrateur
          [Pipeline] Allocate node : Start
          Running on master in C:\Program Files (x86)\Jenkins\workspace\myPipeline
          [Pipeline] node {
          [Pipeline] git
          Cloning the remote Git repository
          remote: Counting objects
          Receiving objects
          Resolving deltas
          Updating references
          Checking out Revision 7dac409d4bd2fec35a4ccde0cb424042cba671df (refs/remotes/origin/master)
          First time build. Skipping changelog.
          [Pipeline] tool
          Unpacking http://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip to C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\M3 on Jenkins
          [Pipeline] bat
          [myPipeline] Running batch script

          C:\Program Files (x86)\Jenkins\workspace\myPipeline>C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\M3\bin\mvn -B verify
          'C:\Program' is not recognized as internal or external command, an executable program or a commands file.
          [Pipeline] } //node
          [Pipeline] Allocate node : End
          [Pipeline] End of Pipeline
          ERROR: script returned exit code 1
          Finished: FAILURE
          {code}

          Workaround: I have to surround ${mvnHome} reference between escaped double quote:
          {code}
          node {
            git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'
            def mvnHome = tool 'M3'
            bat "\"${mvnHome}\"\\bin\\mvn -B verify"
          }
          {code}
          I run Jenkins 2.0 beta binary under Windows 10.
          Following tutorial in https://github.com/jenkinsci/workflow-plugin/blob/master/TUTORIAL.md,
          I created a pipeline job with the following script:
          {code}
          node {
            git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'
            def mvnHome = tool 'M3'
            bat "${mvnHome}\\bin\\mvn -B verify"
          }
          {code}
          I get the following error when running the job:
          {code}
          Started by user Administrateur
          [Pipeline] Allocate node : Start
          Running on master in C:\Program Files (x86)\Jenkins\workspace\myPipeline
          [Pipeline] node {
          [Pipeline] git
          Cloning the remote Git repository
          remote: Counting objects
          Receiving objects
          Resolving deltas
          Updating references
          Checking out Revision 7dac409d4bd2fec35a4ccde0cb424042cba671df (refs/remotes/origin/master)
          First time build. Skipping changelog.
          [Pipeline] tool
          Unpacking http://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip to C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\M3 on Jenkins
          [Pipeline] bat
          [myPipeline] Running batch script

          C:\Program Files (x86)\Jenkins\workspace\myPipeline>C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\M3\bin\mvn -B verify
          'C:\Program' is not recognized as internal or external command, an executable program or a commands file.
          [Pipeline] } //node
          [Pipeline] Allocate node : End
          [Pipeline] End of Pipeline
          ERROR: script returned exit code 1
          Finished: FAILURE
          {code}

          Workaround: I have to surround ${mvnHome} reference between escaped double quote:

          {code}
          node {
            git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'
            def mvnHome = tool 'M3'
            bat "\"${mvnHome}\"\\bin\\mvn -B verify"
          }
          {code}
          lautou Laurent TOURREAU made changes -
          Description I run Jenkins 2.0 beta binary under Windows 10.
          Following tutorial in https://github.com/jenkinsci/workflow-plugin/blob/master/TUTORIAL.md,
          I created a pipeline job with the following script:
          {code}
          node {
            git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'
            def mvnHome = tool 'M3'
            bat "${mvnHome}\\bin\\mvn -B verify"
          }
          {code}
          I get the following error when running the job:
          {code}
          Started by user Administrateur
          [Pipeline] Allocate node : Start
          Running on master in C:\Program Files (x86)\Jenkins\workspace\myPipeline
          [Pipeline] node {
          [Pipeline] git
          Cloning the remote Git repository
          remote: Counting objects
          Receiving objects
          Resolving deltas
          Updating references
          Checking out Revision 7dac409d4bd2fec35a4ccde0cb424042cba671df (refs/remotes/origin/master)
          First time build. Skipping changelog.
          [Pipeline] tool
          Unpacking http://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip to C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\M3 on Jenkins
          [Pipeline] bat
          [myPipeline] Running batch script

          C:\Program Files (x86)\Jenkins\workspace\myPipeline>C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\M3\bin\mvn -B verify
          'C:\Program' is not recognized as internal or external command, an executable program or a commands file.
          [Pipeline] } //node
          [Pipeline] Allocate node : End
          [Pipeline] End of Pipeline
          ERROR: script returned exit code 1
          Finished: FAILURE
          {code}

          Workaround: I have to surround ${mvnHome} reference between escaped double quote:

          {code}
          node {
            git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'
            def mvnHome = tool 'M3'
            bat "\"${mvnHome}\"\\bin\\mvn -B verify"
          }
          {code}
          I run Jenkins 2.0 beta binary under Windows 10.
          Following tutorial in https://github.com/jenkinsci/workflow-plugin/blob/master/TUTORIAL.md,
          I created a pipeline job with the following script:
          {code}
          node {
            git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'
            def mvnHome = tool 'M3'
            bat "${mvnHome}\\bin\\mvn -B verify"
          }
          {code}
          I get the following error when running the job:
          {code}
          Started by user Administrateur
          [Pipeline] Allocate node : Start
          Running on master in C:\Program Files (x86)\Jenkins\workspace\myPipeline
          [Pipeline] node {
          [Pipeline] git
          Cloning the remote Git repository
          remote: Counting objects
          Receiving objects
          Resolving deltas
          Updating references
          Checking out Revision 7dac409d4bd2fec35a4ccde0cb424042cba671df (refs/remotes/origin/master)
          First time build. Skipping changelog.
          [Pipeline] tool
          Unpacking http://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip to C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\M3 on Jenkins
          [Pipeline] bat
          [myPipeline] Running batch script

          C:\Program Files (x86)\Jenkins\workspace\myPipeline>C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\M3\bin\mvn -B verify
          'C:\Program' is not recognized as internal or external command, an executable program or a commands file.
          [Pipeline] } //node
          [Pipeline] Allocate node : End
          [Pipeline] End of Pipeline
          ERROR: script returned exit code 1
          Finished: FAILURE
          {code}

          Workaround: I have to surround $\{mvnHome\} reference between escaped double quote:

          {code}
          node {
            git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'
            def mvnHome = tool 'M3'

          }
          {code}
          lautou Laurent TOURREAU made changes -
          Description I run Jenkins 2.0 beta binary under Windows 10.
          Following tutorial in https://github.com/jenkinsci/workflow-plugin/blob/master/TUTORIAL.md,
          I created a pipeline job with the following script:
          {code}
          node {
            git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'
            def mvnHome = tool 'M3'
            bat "${mvnHome}\\bin\\mvn -B verify"
          }
          {code}
          I get the following error when running the job:
          {code}
          Started by user Administrateur
          [Pipeline] Allocate node : Start
          Running on master in C:\Program Files (x86)\Jenkins\workspace\myPipeline
          [Pipeline] node {
          [Pipeline] git
          Cloning the remote Git repository
          remote: Counting objects
          Receiving objects
          Resolving deltas
          Updating references
          Checking out Revision 7dac409d4bd2fec35a4ccde0cb424042cba671df (refs/remotes/origin/master)
          First time build. Skipping changelog.
          [Pipeline] tool
          Unpacking http://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip to C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\M3 on Jenkins
          [Pipeline] bat
          [myPipeline] Running batch script

          C:\Program Files (x86)\Jenkins\workspace\myPipeline>C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\M3\bin\mvn -B verify
          'C:\Program' is not recognized as internal or external command, an executable program or a commands file.
          [Pipeline] } //node
          [Pipeline] Allocate node : End
          [Pipeline] End of Pipeline
          ERROR: script returned exit code 1
          Finished: FAILURE
          {code}

          Workaround: I have to surround $\{mvnHome\} reference between escaped double quote:

          {code}
          node {
            git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'
            def mvnHome = tool 'M3'

          }
          {code}
          I run Jenkins 2.0 beta binary under Windows 10.
          Following tutorial in https://github.com/jenkinsci/workflow-plugin/blob/master/TUTORIAL.md,
          I created a pipeline job with the following script:
          {code}
          node {
            git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'
            def mvnHome = tool 'M3'
            bat "${mvnHome}\\bin\\mvn -B verify"
          }
          {code}
          I get the following error when running the job:
          {code}
          Started by user Administrateur
          [Pipeline] Allocate node : Start
          Running on master in C:\Program Files (x86)\Jenkins\workspace\myPipeline
          [Pipeline] node {
          [Pipeline] git
          Cloning the remote Git repository
          remote: Counting objects
          Receiving objects
          Resolving deltas
          Updating references
          Checking out Revision 7dac409d4bd2fec35a4ccde0cb424042cba671df (refs/remotes/origin/master)
          First time build. Skipping changelog.
          [Pipeline] tool
          Unpacking http://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip to C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\M3 on Jenkins
          [Pipeline] bat
          [myPipeline] Running batch script

          C:\Program Files (x86)\Jenkins\workspace\myPipeline>C:\Program Files (x86)\Jenkins\tools\hudson.tasks.Maven_MavenInstallation\M3\bin\mvn -B verify
          'C:\Program' is not recognized as internal or external command, an executable program or a commands file.
          [Pipeline] } //node
          [Pipeline] Allocate node : End
          [Pipeline] End of Pipeline
          ERROR: script returned exit code 1
          Finished: FAILURE
          {code}

          Workaround: I have to surround $\{mvnHome\} reference between escaped double quote:

          {code}
          node {
            git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'
            def mvnHome = tool 'M3'
            bat "\"${mvnHome}\"\\bin\\mvn -B verify"
          }
          {code}
          jglick Jesse Glick made changes -
          Labels 2.0 2.0-beta pipeline workflow 2.0 2.0-beta workflow
          jglick Jesse Glick made changes -
          Component/s durable-task-plugin [ 18622 ]
          Component/s workflow-plugin [ 18820 ]
          jglick Jesse Glick made changes -
          Resolution Not A Defect [ 7 ]
          Status Open [ 1 ] Resolved [ 5 ]
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 169921 ] JNJira + In-Review [ 198731 ]
          abayer Andrew Bayer made changes -
          Labels 2.0 2.0-beta workflow 2.0 2.0-beta pipeline workflow
          abayer Andrew Bayer made changes -
          Labels 2.0 2.0-beta pipeline workflow 2.0 2.0-beta pipeline

            People

            Assignee:
            jglick Jesse Glick
            Reporter:
            lautou Laurent TOURREAU
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: