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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Not A Defect
    • pipeline
    • None
    • Jenkins 2.34
      Pipeline 2.4

    Description

      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.
      

      Attachments

        Issue Links

          Activity

            cwcam Cam Spencer created issue -
            rbjorklin Robin Björklin made changes -
            Field Original Value New Value
            Link This issue is related to JENKINS-40338 [ JENKINS-40338 ]
            cwcam Cam Spencer made changes -
            Resolution Not A Defect [ 7 ]
            Status Open [ 1 ] Closed [ 6 ]

            People

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

              Dates

                Created:
                Updated:
                Resolved: