0

I have an a single java project (let's say its name is PROJ) build in gradle and I wanted to run this project X times parallel, using Jenkins jobs. In addition, I would like to pass some parameters strictly to this project and somehow using it during project execution. How to do that?

Example

I have three Jenkins jobs, all executed at 1am:

  • JOB1 is building a gradle project PROJ with parameter PAR=V1
  • JOB2 is building a gradle project PROJ with parameter PAR=V2
  • JOB3 is building a gradle project PROJ with parameter PAR=V3

Inside my java class I want to print the current value of the parameter PAR and the result should be as follows:

JOB1: Value of parameter PAR is V1
JOB2: Value of parameter PAR is V2
JOB3: Value of parameter PAR is V3

(of course due to the fact that tasks will be performed in parallel, messages could be in different order, e.g. V3, V1, V2)

Alternatively, is there a possibility that there can be only one job in Jenkins, but gradle has been configured to build project X times in parallel with different parameters?

Timothy Truckle
  • 15,071
  • 2
  • 27
  • 51
Logrus Wandir
  • 28
  • 1
  • 6
  • Possible duplicate of [How to use Jenkins parameterized builds?](https://stackoverflow.com/questions/18991273/how-to-use-jenkins-parameterized-builds) – Timothy Truckle Mar 12 '18 at 07:22
  • With Jenkins (even using parameterized build) I can run at the same time only as many processes as the node executors are defined (I exclude slaves). So if I wanted to run e.g. 15 instances of job at the same time, it would be impossible. Do gradle settings give this possibility? – Logrus Wandir Mar 12 '18 at 20:42
  • But you can create new jobs "on the fly" through the jenkins API. See https://stackoverflow.com/questions/15909650/create-jobs-and-execute-them-in-jenkins-using-rest and https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API – Timothy Truckle Mar 12 '18 at 22:06

0 Answers0