-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
jenkins 2.107.3, docker image
I am using using Active choice plugin for fetching job list:
def choices=[:] jenkins.model.Jenkins.instance?.getAllItems(com.cloudbees.hudson.plugins.folder.Folder).each { folder -> println "Folder - ${folder}" folder.getItems().each { println "${it.name}" choices.put(folder.name+'/'+it.name, it.name) } } return choices
Result saved in variable JOBS, and then passed to Parameterized trigger plugin in post-build actions.
Post build action: Trigger parameterized build on othern projects. Projects to build: ${JOBS}
Variable JOBS looks like
JOBS=DEV/Build,DEV/Test,DEV/Deploy
Exception raised then parameterized plugin iterates over variable:
java.lang.ArrayIndexOutOfBoundsException: 1 at hudson.plugins.parameterizedtrigger.BuildTrigger.perform(BuildTrigger.java:128) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:690) at hudson.model.Build$BuildExecution.cleanUp(Build.java:196) at hudson.model.Run.execute(Run.java:1774) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429)
Problem is in cycle
In my scenario:
String[] projects = ["DEV/Build", "DEV/Test", "DEV/Deploy"] String[] vars = ["$JOBS]
Iterating over vars is not possible, but upstream jobs still executed.
Maybe something like: if ((vars.length == 1 ? vars[0] : vars[i]).trim().contains("$")) {