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

前端 未结 6 1814
执笔经年
执笔经年 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:29

    Marshal the output and filter for "building: true" from the following call to json api on a job with tree to filter out the extraneous stuff (hope this helps):

    http://jenkins..com/job//api/json?pretty=true&depth=2&tree=builds[builtOn,changeSet,duration,timestamp,id,building,actions[causes[userId]]]
    

    will give you something like:

    {
      "builds" : [
    {
      "actions" : [
        {
    
        },
        {
          "causes" : [
            {
              "userId" : "cheeseinvert"
            }
          ]
        },
        {
    
        },
        {
    
        },
        {
    
        },
        {
    
        }
      ],
      "building" : true,
      "duration" : 0,
      "id" : "2013-05-07_13-20-49",
      "timestamp" : 1367958049745,
      "builtOn" : "serverA",
      "changeSet" : {
    
      }
    }, ...
    

提交回复
热议问题