-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
Currently, the simple-queue-plugin allows privileged users to move specific jobs to the front of the build queue via the web UI. It would be helpful to expose similar functionality via an API endpoint.
See also comments on JENKINS-1878 for a similar request.
This route would be similarly protected and only accessible to users with manage permissions.
Example:
POST /simpleMove/apiMove?moveType=A&itemId=B
The benefits of this would be:
- programmatic prioritization: Its possible to use the existing /simpleMove/move endpoint programatically, but this requires injecting a referer header
- validation: can respond with 400s when request is invalid, or 404s when queue item does not exist.
POST /simpleMove/apiMove?moveType=DOWN_FAST&itemId=-1
404 Not Found
{
"message": "Could not find item with ID -1"
}
Questions:
- Users would need to fetch ahead of time the itemId they want to move. In my case, I can retrieve this from /job/:jobName/:buildNumber/api/json. The required ID is in the queueId field, but it appears to always be one less than required by simple-queue-plugin? Ex. if the /job/:jobName/:buildNumber/api/json endpoint returns queueId 5, I can prioritize the build with /simpleMove/move?itemId=6&... Why is there a difference? Is there a better way to retrieve the itemId?