Pipeline running on OSX can't run 'bat' on Windows node

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

XMLWordPrintable

      Our Jenkins is using OSX, while our slave is running Windows. When I try to run a pipeline script that runs on the Windows slave, I get an error while trying to execute the bat step. It looks like master is trying to run the command (and failing) when it should run fine in a Windows environment.

      Pipeline code

      node('windowsSlave') {
      
              def nodeWorkspace = pwd() + "@script"
      
              def baseGatlingDir = "${nodeWorkspace}\\Gatling_Tests"
              def gatlingTargetDir = "${baseGatlingDir}\\target"
      
              stage('Clear Previous Test Results') {
                  dir("${gatlingTargetDir}") {
                      deleteDir()
                  }
              }
      
              stage('Maven Compile') {
                  dir("${baseGatlingDir}") {
                      bat "mvn test-compile"
                  }
              }
      

      Console output

      [Pipeline] node
      Running on windowsSlave in C:\Jenkins\workspace\Gatling\Pipeline - Acceptance Simulation
      [Pipeline] {
      [Pipeline] pwd
      [Pipeline] stage
      [Pipeline] { (Clear Previous Test Results)
      [Pipeline] dir
      Running in C:\Jenkins\workspace\Gatling\Pipeline - Acceptance Simulation@script\Gatling_Tests\target
      [Pipeline] {
      [Pipeline] deleteDir
      [Pipeline] }
      [Pipeline] // dir
      [Pipeline] }
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] { (Maven Compile)
      [Pipeline] dir
      Running in C:\Jenkins\workspace\Gatling\Pipeline - Acceptance Simulation@script\Gatling_Tests
      [Pipeline] {
      [Pipeline] bat
      [Gatling_Tests] Running batch script
      'cmd' is not recognized as an internal or external command,
      operable program or batch file.
      

            Assignee:
            Unassigned
            Reporter:
            Cam Spencer
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: