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

Pipeline stage does not wait for its commands to finish executing

    • 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'

       

       

       

       

          [JENKINS-44708] Pipeline stage does not wait for its commands to finish executing

          chatur sriganesh s created issue -
          chatur sriganesh s made changes -
          Description Original: 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.

          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'

           

           

           

           
          New: 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'

           

           

           

           
          Jesse Glick made changes -
          Component/s New: durable-task-plugin [ 18622 ]
          Component/s Original: pipeline [ 21692 ]
          Component/s Original: pipeline-build-step-plugin [ 21707 ]
          Component/s Original: pipeline-input-step-plugin [ 21708 ]

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

              Created:
              Updated: