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

Pipeline stage does not wait for its commands to finish executing

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Critical Critical
    • durable-task-plugin
    • None

      Configuration:

      Jenkins version: 2.55

      pipeline:groovy plugin: 2.29

      pipeline:basic Steps plugin:2.4

      pipeline:nodes and processes plpugin: 2.10

      pipeline: shared groovy libraries: 2.7

      I have a master (ubuntu machine) and a slave "testSlave" (windows machine)

       

      I have the following groovy script in my jenkinsfile in github.

      node('TestSlave') {
      stage('Update Slave Code') {
      bat 'start cmd.exe /c UpdateSlaveCode.bat ' + Branch
      sleep(5)
      }

      stage('Compile') {
      bat 'start cmd.exe /w /k CompileAndTest.bat'
      sleep(5)
      }

      stage('Merge Code') {
      bat 'start cmd.exe /w /c Merge.bat '+masterBranch +" "+Branch
      sleep(5)
      }

      Problem: stage('Merge Code') starts before stage('Compile') finishes executing. Note that i am calling a batch file(CompileAndTest.bat) within the bat command.

                                          bat 'start cmd.exe /w /k CompileAndTest.bat'

      So Stage('Compile') just invokes the bat command and considers that stage as complete, however it is yet to finish executing.

      The stage('Merge Code') should wait till stage('Compile') completes

      CompileAndTest.bat is as follows:

             echo 'Compiling and testing...'
             set "mvnErr="
             call mvn clean test || set mvnErr=1

             if %mvnErr%==1 (
             echo 'Maven test failed'
             exit /B 1
             )
             echo '...done testing'

       

       

       

       

            Unassigned Unassigned
            chatursriganesh chatur sriganesh s
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: