From Jenkins, how do I get a list of the currently running jobs in JSON?

前端 未结 6 1824
执笔经年
执笔经年 2020-12-07 17:41

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         


        
6条回答
  •  难免孤独
    2020-12-07 18:40

    I had a similar problem where some pipeline builds get stuck in the building state after I restart jenkins (piepline jobs are supposed to be durable and resume but most of the time they get stuck indefinitely).

    These builds do not use an executor so the only way to find them is to open every job.

    All of the other answers seem to work when the project is considered building, i.e.: the last build is building. But they ignore past builds still building.

    The following query works for me and gives me all the currently running builds, i.e.: they do not have a result.

    http://localhost:8080/api/xml?tree=jobs[name,builds[fullDisplayName,id,number,timestamp,duration,result]]&xpath=/hudson/job/build[count(result)=0]&wrapper=builds

提交回复
热议问题