Here is my buildflow which executes a shell script...
Remember buildflow is DSL which is Groovy..
-----------------------------------
def JobCode = "REL"
def JobName = build.environment.get( "JOB_NAME" )
def BuildURL = build.environment.get( "BUILD_URL" )
def BuildNum = build.environment.get( "BUILD_NUMBER" )
def RevNum = build.environment.get( "GIT_COMMIT" )
def WrkSpce = build.environment.get( "WORKSPACE" )
def svnUrl = build.environment.get( "SVN_URL" )
out.println "Running Build for: "+JobName
def PathToWorkSpace = "jobs/"+JobName+"/workspace/"
def script=WrkSpce+"/Tools/PomVersionUpdater.sh "+JobCode+"-"+RevNum+BuildNum
def executeOnShell(String command) {
return executeOnShell(command, new File(System.properties.'user.dir'))
}
private def executeOnShell(String command, File workingDir) {
println command
def process = new ProcessBuilder(addShellPrefix(command))
.directory(workingDir)
.redirectErrorStream(true)
.start()
process.inputStream.eachLine {println it}
process.waitFor();
return process.exitValue()
}
private def addShellPrefix(String command) {
commandArray = new String[3]
commandArray[0] = "sh"
commandArray[1] = "-c"
commandArray[2] = command
return commandArray
}
executeOnShell(script)
build(JobCode+"-applicant-beans-bld", "PathToWorkSpace": PathToWorkSpace)
build(JobCode+"-configuration-beans-bld", "PathToWorkSpace": PathToWorkSpace)
build(JobCode+"-unicas-framework-bld", "PathToWorkSpace": PathToWorkSpace)
build(JobCode+"-unicas-security-bld", "PathToWorkSpace": PathToWorkSpace)
parallel (
{
build(JobCode+"-applicant-gateway-ui-bld", "PathToWorkSpace": PathToWorkSpace)
build(JobCode+"-evaluator-ui-bld", "PathToWorkSpace": PathToWorkSpace)
build(JobCode+"-unicas-configuration-ws-bld", "PathToWorkSpace": PathToWorkSpace)
},
{
build(JobCode+"-applicant-ui-bld", "PathToWorkSpace": PathToWorkSpace)
build(JobCode+"-management-ui-bld", "PathToWorkSpace": PathToWorkSpace)
build(JobCode+"-unicas-commonservices-bld", "PathToWorkSpace": PathToWorkSpace)
},
{
build(JobCode+"-configuration-ui-bld", "PathToWorkSpace": PathToWorkSpace)
build(JobCode+"-unicas-gateway-ws-bld", "PathToWorkSpace": PathToWorkSpace)
build(JobCode+"-unicas-ws-bld", "PathToWorkSpace": PathToWorkSpace)
}
)