Reputation: 3737
Is a way to get info of selected builds with Jenkins2 REST call but without knowledge of job names (i.e. not per job, but from all builds), something like SQL:
select number,result from all_builds_in_jenkins;
?
Upvotes: 1
Views: 1190
Reputation: 7355
You can get everything in a json file, with the following get:
http://jenkins.example.com/api/json?tree=jobs[name,builds[number,actions[parameters[name,value]]]]&pretty=true
Sample output:
{
"jobs" : [
{
"name" : "Job name - Build",
"builds" : [
{
"actions" : [
{
"parameters" : [
{
"name" : "GIT_COMMIT_PARAM",
"value" : "5447e2f43ea44eb4168d6b32e1a7487a3fdf237f"
}
]
},
(...)
If you need only the list of jobs:
http://jenkins.example.com/api/json?tree=jobs[name,color]&pretty=true
Sample output:
{
"_class" : "hudson.model.ListView",
"jobs" : [
{
"_class" : "com.cloudbees.hudson.plugins.folder.Folder",
"name" : "DEV"
},
{
"_class" : "com.cloudbees.hudson.plugins.folder.Folder",
"name" : "Libs"
},
{
"_class" : "hudson.model.FreeStyleProject",
"name" : "Dummy project",
"color" : "red"
},
]
}
Upvotes: 2