I have to build a jenkins pipeline job using groovy script, what the job has to do is, first run an windows batch command, and only if the batch command build is successful, it should call build for another job. How can I find out is the windows batch command was build successfully. I am showing sample code for the query.
import groovy.json.JsonSlurper;
import hudson.model.*
import hudson.EnvVars
pipeline {
agent any
stages {
stage('Build')
{
steps{
bat 'some batch command here'
// if(bat build successful)---> need help here
build 'xyz' //xyz is another job that I am calling here
}
}
}