Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How start identical jobs with different parameters in parallel execution?

Tags:

I have a build job and a test job parameters.

I want to be after the build job, simultaneously run test job with one parameter and the same test job with different parameters in parallel execution.

                build job                      |                     / \            test job    test job    with one params    with other params             |             | 

How to accomplish this and whether it is possible to perform without having to write your own plugin?

Thanks!

like image 413
Maksim Kolchin Avatar asked Apr 11 '11 17:04

Maksim Kolchin


People also ask

How do you run the same job multiple times in parallel with Jenkins?

You will need to configure your "child" job so that it can run in parallel by checking the "Execute concurrent builds if necessary" in the job configuration. Whatever set of slaves provide the connection to the embedded devices will need enough executors to run your jobs in parallel.

How can you pass parameters from one job to another job in Jenkins?

You can use Parameterized Trigger Plugin which will let you pass parameters from one task to another. You need also add this parameter you passed from upstream in downstream.


2 Answers

When you create your test job, create it as a "Build multi-configuration project" While configuring the job select "Configuration Matrix" then "User-defined axis"

You can use the name of this axis as a parameter in your job. the given parameters will be started simultaneous in different jobs. (if enough executors are available)

like image 115
HenkI Avatar answered Oct 01 '22 18:10

HenkI


Playing off @Soo Wei Tan's answer, I found the following works well.

  • Parameterized Trigger Plugin
  • Choose "Parameter Factory"
  • Choose "For every property file, invoke one build"

Then, in a shell, write a series of property files, and the Trigger Plugin will take care of the rest.

You can even combine this with a matrix style job at the top level in interesting ways. For example, triggering on the user-defined axis, keeping track of it all with a grid. Really quite a flexible approach, if a bit hidden.

like image 40
dpb Avatar answered Oct 01 '22 20:10

dpb