-
Bug
-
Resolution: Unresolved
-
Critical
-
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'