2

I have a fairly simple problem, but I can`t find a good solution online or in the documentation so far.

I have a jenkins job that has two String Parameters (param1, param2)

I want to be able to add more than one value to param2, so that the job executes a new iteration for each value of param2.

Job Execution 1: Param1, Param2[Value1]
Job Execution 2: Param1, Param2[Value2]
Job Execution 3: Param1, Param2[Value3]

The trigger is a Cron (Build Schedule) once a week, so choice type parameters are not a good option.

I`m aware I could use the jenkins API to call the job with the parameters I want with looped curl commands or such, or to create a second job, (MultiJob) that would call my job with different parameter combinations.

I`m looking to see is there a way of doing it all in one job.

Patrick
  • 107
  • 11
  • 1
    Can you give any context for why you'd like to do something like this? – AJ X. Aug 25 '17 at 18:20
  • Param2 is a list of repositories, I want to be able to quickly "add" a new repository to certain maintenance tasks that are executed on each one. Over time, more repositories will need to be added to the list. It's important that adding one repo can be done very quickly. – Patrick Aug 28 '17 at 19:17

1 Answers1

1

I think you can use the Matrix job. Parameter 1 will be static , and parameter 2 will contain the 3 options for it.

Each run it will run all the combination Param1 , param2 ( first value) Param1 , param2 ( second value) Param1 , param2 ( third value)

Mor Lajb
  • 2,546
  • 1
  • 15
  • 28
  • Actually, this is the solution i am looking for. I looked at the matrix build, but I assumed that this was not what I wanted since it was using the term 'axis' instead of something more intuitive. I was not able to determine whether I could overwrite String Parameters with the matrix build. (MultiConfig Job) (Unfortunetly there is another problem with the Git Plugin not refreshing git rev-parse refs/remotes/origin/master^{commit} between builds. This answer is still what I`m looking for! – Patrick Aug 28 '17 at 20:38