I am running external script to trigger parameterized Jenkins job.Basically I want to run parallel jobs. But I don't want to execute the job with same parameter is already running. I guess, That logic I have write into the external script. Now my question is, let's say Job is running with parameter A, B and C. In this case I should be able to trigger Job with parameter D, E,F but at the same I should not able to trigger job with A, B and C parameter as it is already running. To achive that I need to know running build with their parameters. How can I do that?
1 Answer
First you need to get the current build ID (the build in running state).
You can have a look here how to do that.
Then use this id do get the parameters of the job.
Considering 18 the build ID
http://your-jenkins-server.domain.com/jobName/18/parameters/
Compare the parameters between current build and possible next build to trigger.
I advise you to read Jenkins API for general information and also take a look at
http://your-jenkins-server.domain.com/jobName/api