Determine if given job is currently running using Hudson/Jenkins API

前端 未结 5 948
忘掉有多难
忘掉有多难 2020-12-29 05:24

Is there an API to determine whether a given job is currently running or not?

Ideally, I\'d also like to be able to determine its estimated % complete and get the de

5条回答
  •  醉话见心
    2020-12-29 05:56

    As gareth_bowles and Sagar said, using the Jenkins API is the way to know. If you put the depth to 1, you will see what you're looking for:

    http://host/job/project/lastBuild/api/xml?depth=1
    

    You will see there's a tag to tell if that build is running

    ...
    
      
        
            Started by user Zageyiff
            Zageyiff
            Zageyiff
        
      
      true
      0
      -1
      Project #12
      2012-08-24_08-58-45
      false
      12
      123456789
      
            http://host/job/project/12
      
      master
      
      3.0.3
    
    ...
    

提交回复
热议问题