-
Bug
-
Resolution: Fixed
-
Critical
-
Jenkins >= 1.601
Please look at the following comment:
This behavior does not work anymore in Jenkins 1.601.
The queue item URL which is in the location header of the start-build URL returns HTTP status code 404.
Steps to reproduce the problem
Start build via Remote API
The initial request was:
http://myjenkins/job/zzz_dummy_a61d370a3954428a949b87fc3d8f3cf8/build
The HTTP header contains the correct location URL:
HTTP/1.1 201 Created
Date: ...
Server: ...
Location: http://myjenkins/queue/item/68/
Queue object while build is in the queue
That works in all used Jenkins versions.
URL: https://myjenkins:8081/queue/api/json
JSON response:
{ "items": [ { "actions": [ { "causes": [ { "shortDescription": "Started by user XYZ", "userId": "xyz", "userName": "xyz" } ] } ], "blocked": false, "buildable": false, "id": 68, "inQueueSince": 1425545634280, "params": "", "stuck": false, "task": { "name": "zzz_dummy_a61d370a3954428a949b87fc3d8f3cf8", "url": "https://myjenkins:8081/job/zzz_dummy_a61d370a3954428a949b87fc3d8f3cf8/", "color": "notbuilt" }, "url": "queue/item/68/", "why": "In the quiet period. Expires in 4.2 sec", "timestamp": 1425545639280 } ] }
Queue item object while build is in the queue
That does not work anymore in Jenkins 1.601. The following queue item URL is not found (HTTP status code 404).
URL: https://myjenkins:8081/queue/item/68/api/json
JSON response:
{ "actions": [ { "causes": [ { "shortDescription": "Started by user xyz "userId": "xyz", "userName": "xyz" } ] } ], "blocked": false, "buildable": false, "id": 68, "inQueueSince": 1425545634280, "params": "", "stuck": false, "task": { "name": "zzz_dummy_a61d370a3954428a949b87fc3d8f3cf8", "url": "https://myjenkins:8081/job/zzz_dummy_a61d370a3954428a949b87fc3d8f3cf8/", "color": "blue" }, "url": "queue/item/68/", "why": null, "cancelled": false, "executable": { "number": 1, "url": "https://myjenkins:8081/job/zzz_dummy_a61d370a3954428a949b87fc3d8f3cf8/1/" } }
Cause of the issue
The reasons of the problem could be:
- The quiet period parameter is ignored. (In our case in it is 5 seconds by default.) That would mean, that queue item is deleted very fast and could not be requested properly.
- Maybe the queue item URL is not yet created anymore.
Possible Solution
In my opinion the solution would be to make the queue item URL still accessible even if the queue item is deleted. For our build workflow that would be a fine solution.
Or is there any other way to request finished queue items?
Goal
Our goal is to track a Jenkins build via external tools. So if there is another way to safely track a started build, please let me know.