Within the browser for my jenkins job I'm running the following query.
lastStableBuild/api/json?pretty=true&tree=actions[buildsByBranchName[*[*]]]
Results from the above query
{
"_class" : "hudson.model.FreeStyleBuild",
"actions" : [
{
"_class" : "hudson.model.CauseAction"
},
{
},
{
"_class" : "jenkins.metrics.impl.TimeInQueueAction"
},
{
},
{
"_class" : "hudson.plugins.git.util.BuildData",
"buildsByBranchName" : {
"my-branch-name" : {
"_class" : "hudson.plugins.git.util.Build",
"buildNumber" : 587,
"buildResult" : null,
"marked" : {
"SHA1" : "***",
"branch" : [
{
}
]
},
"revision" : {
"SHA1" : "***",
"branch" : [
{
}
]
}
},
"my-other-branch-name" : {
"_class" : "hudson.plugins.git.util.Build",
"buildNumber" : 1373,
"buildResult" : null,
"marked" : {
"SHA1" : "***",
"branch" : [
{
}
]
},
"revision" : {
"SHA1" : "***",
"branch" : [
{
}
]
}
},
I would like to be able to narrow it down to just the build number like you would get with
/lastSuccessBuild/buildNumber
using the api but I would settle for just everything inside of the branch name key so that I wouldn't have to loop through all branches and compare the name. I'm assuming I can narrow it down more where I have my "*"
specified but can't figure out the right syntax to use.