I have a groovy post-build script that dynamically calls for a sub jobs based on an input file file.txt
:
Each line in file.txt
is then passed into a new subjob.
import hudson.model.*
def file = manager.build.getParent().getWorkspace().child('file.txt')
def lines = file.readToString().split('\r\n')
lines.each { String line ->
childProjectName = "childProjectName"
job = manager.hudson.getItem(childProjectName)
def params = new StringParameterValue('Input_Variable', line)
def paramsAction = new ParametersAction(params)
def cause = new hudson.model.Cause.UpstreamCause(manager.build)
def causeAction = new hudson.model.CauseAction(cause)
def waitingItem = manager.hudson.queue.schedule(job, 0, causeAction, paramsAction)
}
I'd like to block the parent job until all sub jobs are done and based on their statuses pass/fail the parent job.
Any idea how to do it dynamically?