jenkinsapi icon indicating copy to clipboard operation
jenkinsapi copied to clipboard

Get jobs by build status

Open driscollis opened this issue 5 years ago • 2 comments

ISSUE TYPE
  • Feature Idea
Jenkins VERSION

Latest

SUMMARY

I would like a way to ask Jenkins for a filtered list of jobs based on the build's status. For example, I would like to get all jobs where the build status was 'ABORTED' or 'UNSTABLE' versus 'SUCCESS'.

I know Jenkins knows which jobs have failed, but I don't see a good way to ask for just that information using jenkinsapi. I currently wrote a loop to loop over all the jobs in a view and check the job's build status, but that is really clunky and takes a long time since I have to query all the jobs.

driscollis avatar Jan 02 '20 21:01 driscollis

AFAIK, there is no way of achieving that using REST API because there is no way to filter output. So loop is the only way to do that and I don't think that jenkinsapi should do that for you.

lechat avatar Jan 03 '20 10:01 lechat

That's interesting as Jenkin's itself will show you which jobs have failed (i.e. yellow dots versus blue dots) in a view. I'm surprised they don't expose that.

Iterating over hundreds of builds is really slow though. I can probably just go to a view's page and use BeautifulSoup to extract the tooltip / alt tag and maybe parse out the Unstable jobs that way

driscollis avatar Jan 03 '20 15:01 driscollis