catch32
catch32

Reputation: 18582

How to run Jenkins job with different parameters for many runs?

I need to execute primary-job Jenkin's job with different parameters.

For this purpose, I created separate job execute-job with Build flow plugin.

and DSL script with Groovy looks like:

// #1 - Build cluster
ignore(FAILURE) {
    b = build("primary-job",
            "KILL_CLUSTER": "true",
            "BUILD_CLUSTER": "true",

            "CALLS_RATE": "50",
            "MAX_SIMULT_CALLS": "400",
            "LOCAL_CODEC": "PCMU",
            "REMOTE_CODEC": "PCMU",
            "NUM_LOOPS": "4",
            "VOICE_TRACE": "0",
            "MAX_LOSS_PERCENT": "1",
            "NUM_RUNS": "3",

            "RECORD": "true",
            "NUM_CHANNELS": "1"
    )
}
// #2
ignore(FAILURE) {
    b = build("primary-job",
            "BUILD_CLUSTER": "false",

            "CALLS_RATE": "50",
            "MAX_SIMULT_CALLS": "400",
            "LOCAL_CODEC": "PCMU",
            "REMOTE_CODEC": "PCMU",
            "NUM_LOOPS": "4",
            "VOICE_TRACE": "0",
            "MAX_LOSS_PERCENT": "1",
            "NUM_RUNS": "3",

            "RECORD": "true",
            "NUM_CHANNELS": "2"
    )
}
.....

Abowe you can see only 2 runs.

However, I need to make such job triggering ~320 times.

Even if one job failed we have to run next one.

I believe I can't to type manually to DSL script so long build execution list. It is too long.

I can't find any solution for this task.

How to call one Jenkins job from another with different parameter so many times?

Upvotes: 0

Views: 1512

Answers (1)

Niels Bech Nielsen
Niels Bech Nielsen

Reputation: 4859

The script is written in Groovy, so you should be able to use that to script it.

[ "job1", "job2", "job3" ].each { jobname ->
   ignore(FAILURE) {
      b = build( jobname)
   }
}

Upvotes: 1

Related Questions