Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins - Running instances of single build concurrently

Tags:

I'd like to be able to run several builds of the same Jenkins job simultaneously.

Example:

  1. Build [*jenkins_job_1*]: calls an ant script with parameter 'A'
  2. Build [*jenkins_job_1*]: calls an ant script with parameter 'B'
  3. repeat as necessary
  4. each instance of the job runs simultaneously, rather than through a queue.

The reason I'd like to do this is to avoid having to create several jobs that are nearly identical, all of which would need to be maintained.

Is there a way to do this, or maybe another solution (ie — dynamically create a job from a base job and remove it after it's finished)?

like image 772
qpi Avatar asked May 27 '11 13:05

qpi


People also ask

How many concurrent builds can I run on single Jenkins?

If you run a single Jenkins instance with on build slaves, you can define how many concurrent build executors you want on the main configuration page at [your Jenkins URL]/configure - I've had success setting up 2 executors per CPU core available, but that will depend on what your builds do and how much CPU they need ...

Can Jenkins run multiple jobs simultaneously?

Yes it's possible. Doc: If this option is checked, Jenkins will schedule and execute multiple builds concurrently (provided that you have sufficient executors and incoming build requests.)

How do I stop parallel builds in Jenkins?

Disable concurrent builds in Jenkins declarative pipeline. Define disableConcurrentBuilds option to disallow concurrent executions.


1 Answers

Jenkins has a check box: "Execute concurrent builds if necessary"

If you check this, then it'll start multiple builds for a job.

This works with the "This build is parameterized" checkbox.

You would still trigger the builds, passing your A or B as parameters. You can use another job to trigger them or you could do it manually via a script.

like image 190
docwhat Avatar answered Nov 02 '22 08:11

docwhat