How to trigger multiple down stream jobs in jenkins dynamically based on some input parameter -


scenario: want trigger few down stream jobs(job , job b ....) dynamically based on input parameter received current job.

import hudson.model.*  def values = ${configname}.split(',') def currentbuild = thread.currentthread().executable  println ${configname} println ${sourcebranch}  values.eachwithindex { item, index ->     println item     println index  def job = hudson.model.hudson.instance.getjob(item) def params = new stringparametervalue('upstream_job', ${sourcebranch})   def paramsaction = new parametersaction(params)  def cause = new hudson.model.cause.upstreamcause(currentbuild) def causeaction = new hudson.model.causeaction(cause)  hudson.model.hudson.instance.queue.schedule(job, 0, causeaction, paramsaction) } 

how this? getting comma separated list upstream system , splitted them individaul string internally jobs. making call passing each individual strings.


Comments

Popular posts from this blog

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -