I am using a groovy script to run other tasks that are based on an example from the Groovy plugin page.
I get a list of tasks as a parameter, check their existence and run them with several parameters. See Main Launch Code:
// Prepare parameters array def params = [ new StringParameterValue('PARAM1', 'val1'), new StringParameterValue('PARAM2', 'val2'), ] def future = job.scheduleBuild2(0, new Cause.UpstreamCause(build), new ParametersAction(params)) println "Waiting for the completion of " + jobLink anotherBuild = future.get()
My running jobs work fine, but with one major problem. Their initial parameters are lost and replaced with the new PARAM1 and PARAM2 .
How can I run a task and add to its default parameters and not replace them?
I tried to find a solution for him and did not find ...
EDIT: I thought not to set the parameters (and let the job use its default values), but set the environment variables to complete the job. Does anyone have an idea or example on how to do this?
jenkins groovy
Eldad AK
source share