0
votes

I have created a Global choice Parameter using Extensible Choice Parameter plugin.

I am using this parameter list in one of my parametrized jenkins job.

Is there a way in jenkins, where I can execute the job with each of the parameters in the Global choice Parameter list?

I have had a look on Build Flow job in jenkins, as suggested in this answer, but it seems it accepts hardcoded parameters only, and not dynamic.

1

1 Answers

0
votes

I finally managed to resolve this using the following steps (with great help from this post) -

As my parameters list is dynamic in nature, it could be added or modified according to other jobs, we have managed it in a text file.

Next, We have used Extensible Choice Parameter plugin to display the parameters, using the groovy script -

def list = [];
File file = new File("D:/JenkinJob/parameterList.txt")

file.eachLine { line ->
  list.add("$line")
}
return list

enter image description here

Now I want to call this jenkins job for each of the parameter. For this, I have installed, BuildFlow plugin, and crated a new jenkins job of BuildFlow type - enter image description here

Next, get the Extended Choice Parameter plugin, and configure it as follows - enter image description here

Now in the flow step of this job, write this script, where "Feature" is the parameter, that is just created above, and within call to "build" parameter, pass in the name of job which we want to call for each parameter -

def features = params['Features'].split(',')

for (feature in features ) {
    build("JobYouWantToCall", JobParameter: feature,)
}