jenkins API: Where can I find a definition of all the possible values for the "color" variable of the "jobs" object?

3,237 views
Skip to first unread message

Jorge Vargas

unread,
Apr 18, 2011, 12:19:02 PM4/18/11
to jenkins...@googlegroups.com
Hi,

I got a script that currently parses the output of the API in order to
determine programmatically the status of all our builds and report on
non-stable. I first try to go with "red" but then we notice a
"red_anime", so we changed our code, now it seems like "yellow" is
another failed status. And since we are using the "green balls plugin"
we didn't want to use "blue" or "green" as that will probably change.

So I ask where is the full list of values this variable has? is it
only in jenkins source? Which is the best way to calculate if all jobs
are not ok from within the API?

Frédéric Camblor

unread,
Apr 18, 2011, 12:54:48 PM4/18/11
to jenkins...@googlegroups.com
Hi Jorge,

Have you looked at Global build stats plugin JSON & REST API ?

Particularly on the last section ("Build stats chart data") : by defining some charts configs, you will then be able to query jenkins global builds statistics

Frédéric

2011/4/18 Jorge Vargas <jorge....@gmail.com>



--
Frédéric Camblor

Jorge Vargas

unread,
Apr 18, 2011, 5:10:55 PM4/18/11
to jenkins...@googlegroups.com
That seems to be a little overkill.

For anyone else looking for this the source seems to be the only "docs"
https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/BallColor.java

2011/4/18 Frédéric Camblor <fcam...@gmail.com>:

Frédéric Camblor

unread,
Apr 18, 2011, 5:30:26 PM4/18/11
to jenkins...@googlegroups.com
I was thinking you was looking for a "global" computed build statistics (when you're saying "determine programmatically the status of all our builds and report on non-stable" << that's exactly what the global build stats does).

If you're only looking for a particular job result, you can go on http://<jenkins_url>/job/<your_job>/lastBuild/api/json and retrieve the /result/ property.
Possible values are : SUCCESS, FAILURE, ABORTED, UNSTABLE, NOT_BUILD (see https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/Result.java)

Some example :
Frédéric
--
Frédéric Camblor

Jorge Vargas

unread,
Apr 18, 2011, 5:47:01 PM4/18/11
to jenkins...@googlegroups.com
I already have code working for this where we cycle all the current
jobs based on one API call. The only problem is that we where looking
for "red" in the color variable and that was giving us problems
because "yellow" is also a failed state. With the list in BallColor I
now know all the values and can create a better parser to accomodate
for all options.

2011/4/18 Frédéric Camblor <fcam...@gmail.com>:

Reply all
Reply to author
Forward
0 new messages