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

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -