I can find out just about everything about my Jenkins server via the Remote API, but not the list of currently running jobs.
This,
http://my-jenkins/computer/api/json
or
http://my-jenkins/computer/(master)/api/json
Would seem like the most logical choices, but they say nothing (other than the count of jobs) about which jobs are actually running.
Best Answer
There is often confusion between jobs and builds in Jenkins, especially since jobs are often referred to as 'build jobs'.
See https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project for more information.
If you want the jobs that are currently building (i.e. have one or more running builds), the fastest way is to use the REST API with XPath to filter on colors that end with
_anime
, like this:will give you something like:
Jenkins uses the
color
field to indicate the status of the job, where the_anime
suffix indicates that the job is currently building.Unfortunately, this won't give you any information on the actual running build. Multiple instances of the job maybe running at the same time, and the running build is not always the last one started.
If you want to list all the running builds, you can also use the REST API to get a fast answer, like this:
Will give you something like:
Here you see a list off all the currently running builds. You will need to parse the URL to separate the job name from the build number. Notice how
my_first_job
has two builds that are currently running.