+def anotherBuild
+jobs.each { job ->
+ def jobName = job.getName()
+ if (jobName.startsWith(jobStartWith)) {
+ def lastBuild = job.getLastBuild()
+ if (lastBuild == null) {
+ try {
+ def future = job.scheduleBuild2(0, new Cause.UpstreamCause(build))
+ println "\\tLaunched " + HyperlinkNote.encodeTo('/' + job.url, job.fullDisplayName)
+ } catch (CancellationException x) {
+ throw new AbortException("\${job.fullDisplayName} aborted.")
+ }
+ } else {
+ println("\\tAlready built")
+ }
+ }
+}
+
+if (fail){
+ throw new AbortException("Some job failed")
+}
+"""
+ def dslTriggerModule = """\
+import hudson.model.*
+import hudson.AbortException
+import hudson.console.HyperlinkNote
+import java.util.concurrent.CancellationException
+
+
+def jobs = hudson.model.Hudson.instance.items
+def fail = false
+def jobStartWith = "JOBPREFIX"
+