我似乎无法通过API找到队列中项目的作业名称。我错过了什么(很明显)?
我创建了两个虚拟作业,需要一台名为&#34; build1&#34;离线。</ p>
当我访问http://JENKINS_URL:8080/queue/api/json时,我明白了:
{
"_class": "hudson.model.Queue",
"discoverableItems": [],
"items": [
{
"_class": "hudson.model.Queue$BuildableItem",
"actions": [
{}
],
"blocked": false,
"buildable": true,
"id": 262,
"inQueueSince": 1529331225093,
"params": "",
"stuck": true,
"task": {
"_class": "org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask"
},
"url": "queue/item/262/",
"why": "build1 is offline",
"buildableStartMilliseconds": 1529331225094,
"pending": false
},
{
"_class": "hudson.model.Queue$BuildableItem",
"actions": [
{}
],
"blocked": false,
"buildable": true,
"id": 260,
"inQueueSince": 1529331219128,
"params": "",
"stuck": true,
"task": {
"_class": "org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask"
},
"url": "queue/item/260/",
"why": "build1 is offline",
"buildableStartMilliseconds": 1529331219128,
"pending": false
}
]
}
如果我访问http://JENKINS_URL:8080/queue/item/262/api/json,我什么也得不到(只是项目本身)。
但是,如果我创建了一个因crontab创建而暂停的项目,并且前一个项目仍在执行中,那么它不再是hudson.model.Queue$BuildableItem
而是{{1在那里,hudson.model.Queue$BlockedItem
键有一个完整的对象,其中包含更多详细信息......以及名称。
我知道在哪里可以找到队列中任何项目的作业名称(而不是特定队列,顺便说一句)?
谢谢!