jenkinsci / jenkinsci/durable-task-plugin

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

Open
#389 1 comment 0 reactions 0 assignees View on GitHub
component:durable-task-plugin imported-jira-issue priority:critical resolution:unresolved
Dominant language
Java
Stars
30
Forks
101
PR merge metrics
No merged PRs in 30d

Description

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'

 

 

 

 

---
Originally reported by chatursriganesh, imported from: Pipeline stage does not wait for its commands to finish executing


  • status: Open
  • priority: Critical
  • component(s): durable-task-plugin
  • resolution: Unresolved
  • votes: 0
  • watchers: 2
  • imported: 2025-12-09

Raw content of original issue

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'

 

 

 

 

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.