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

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


    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • pipeline
    • None
    • Jenkins 2.34
      Pipeline 2.4

      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}") {
              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.

            Unassigned Unassigned
            cwcam Cam Spencer
            1 Vote for this issue
            2 Start watching this issue