/queue/item/
дает вам элементы в очереди, которые ожидают запуска, а 404 означает, что элемент не в очереди, может быть отменен или выполнен. Выполнение задания может быть в состоянии «Выполнено», «Завершено» или «Отменено».
Вы можете использовать queueId
(36285
в вашем примере), получить сведения о задании и получить статус сборки для конкретного queueId
. В ответе на запрос ниже указаны детали работы со сборками. Вы можете найти нужную сборку по queueId
в builds
и получить building
(логическое значение) и result
статус:
JENKINS_URL+"/job/"+ artifactToBuild +"/api/json?depth=1'
Пример ответа для JENKINS_URL+"/job/"+ artifactToBuild +"/api/json?depth=1'
:
{
"_class": "org.jenkinsci.plugins.workflow.job.WorkflowJob",
"actions": [],
"description": "",
"displayName": "my_job_name",
"displayNameOrNull": null,
"fullDisplayName": "my_job_name",
"fullName": "my_job_name",
"name": "my_job_name",
"url": "http://localhost:8080/job/my_job_name/",
"buildable": true,
"builds": [
{
"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
"actions": [],
"artifacts": [],
"building": false,
"description": null,
"displayName": "#1",
"duration": 1651,
"estimatedDuration": 1671,
"executor": null,
"fullDisplayName": "my_job_name #1",
"id": "1",
"keepLog": false,
"number": 1,
"queueId": 103,
"result": "SUCCESS",
"timestamp": 1580946018635,
"url": "http://localhost:8080/job/my_job_name/1/",
"changeSets": [],
"culprits": [],
"nextBuild": {
"number": 2,
"url": "http://localhost:8080/job/my_job_name/2/"
},
"previousBuild": null
}
],
"color": "aborted",
"firstBuild": {},
"healthReport": [
{
"description": "Build stability: No recent builds failed.",
"iconClassName": "icon-health-80plus",
"iconUrl": "health-80plus.png",
"score": 100
}
],
"inQueue": false,
"keepDependencies": false,
"lastBuild": {
"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
"actions": [],
"artifacts": [],
"building": false,
"description": null,
"displayName": "#10",
"duration": 1238044,
"estimatedDuration": 1671,
"executor": null,
"fullDisplayName": "my_job_name #10",
"id": "10",
"keepLog": false,
"number": 10,
"queueId": 587,
"result": "ABORTED",
"timestamp": 1581534463735,
"url": "http://localhost:8080/job/my_job_name/10/",
"changeSets": [],
"culprits": [],
"nextBuild": null,
"previousBuild": {
"number": 9,
"url": "http://localhost:8080/job/my_job_name/9/"
}
},
"lastCompletedBuild": {
"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
"actions": [],
"artifacts": [],
"building": false,
"description": null,
"displayName": "#10",
"duration": 1238044,
"estimatedDuration": 1671,
"executor": null,
"fullDisplayName": "my_job_name #10",
"id": "10",
"keepLog": false,
"number": 10,
"queueId": 587,
"result": "ABORTED",
"timestamp": 1581534463735,
"url": "http://localhost:8080/job/my_job_name/10/",
"changeSets": [],
"culprits": [],
"nextBuild": null,
"previousBuild": {
"number": 9,
"url": "http://localhost:8080/job/my_job_name/9/"
}
},
"lastFailedBuild": null,
"lastStableBuild": {
"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
"actions": [],
"artifacts": [],
"building": false,
"description": null,
"displayName": "#2",
"duration": 1671,
"estimatedDuration": 1671,
"executor": null,
"fullDisplayName": "my_job_name #2",
"id": "2",
"keepLog": false,
"number": 2,
"queueId": 105,
"result": "SUCCESS",
"timestamp": 1580946027378,
"url": "http://localhost:8080/job/my_job_name/2/",
"changeSets": [],
"culprits": [],
"nextBuild": {
"number": 3,
"url": "http://localhost:8080/job/my_job_name/3/"
},
"previousBuild": {
"number": 1,
"url": "http://localhost:8080/job/my_job_name/1/"
}
},
"lastSuccessfulBuild": {
"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
"actions": [],
"artifacts": [],
"building": false,
"description": null,
"displayName": "#2",
"duration": 1671,
"estimatedDuration": 1671,
"executor": null,
"fullDisplayName": "my_job_name #2",
"id": "2",
"keepLog": false,
"number": 2,
"queueId": 105,
"result": "SUCCESS",
"timestamp": 1580946027378,
"url": "http://localhost:8080/job/my_job_name/2/",
"changeSets": [],
"culprits": [],
"nextBuild": {
"number": 3,
"url": "http://localhost:8080/job/my_job_name/3/"
},
"previousBuild": {
"number": 1,
"url": "http://localhost:8080/job/my_job_name/1/"
}
},
"lastUnstableBuild": null,
"lastUnsuccessfulBuild": {
"_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
"actions": [],
"artifacts": [],
"building": false,
"description": null,
"displayName": "#10",
"duration": 1238044,
"estimatedDuration": 1671,
"executor": null,
"fullDisplayName": "my_job_name #10",
"id": "10",
"keepLog": false,
"number": 10,
"queueId": 587,
"result": "ABORTED",
"timestamp": 1581534463735,
"url": "http://localhost:8080/job/my_job_name/10/",
"changeSets": [],
"culprits": [],
"nextBuild": null,
"previousBuild": {
"number": 9,
"url": "http://localhost:8080/job/my_job_name/9/"
}
},
"nextBuildNumber": 11,
"property": [
{
"_class": "hudson.plugins.jira.JiraProjectProperty"
},
{
"_class": "org.jenkinsci.plugins.workflow.job.properties.DisableConcurrentBuildsJobProperty"
}
],
"queueItem": null,
"concurrentBuild": false,
"resumeBlocked": false
}