I would like to use the REST API to get the list of queue builds and their 
respective "assigned label". Basically, I need to know that a build is 
waiting in the queue for a node with label X.

Through the REST API (*/queue/api/json?pretty=true*) I'm able to get the 
reason *why *the build is pending, which does not always tell me the label.

*Example:*
-----
If I trigger a build for a label that's not provided by any of the current 
nodes, this is the *why* I get:
*"There are no nodes with the label ‘MyTestNonExistingLabel"*

The Jenkins API will tell me the exact label *'MyTestNonExistingLabel'* 
through the method *Queue.Item#getAssignedLabel()*

-----
However, if I trigger a build for a label that's provided by one of the 
current nodes, and the node in question is busy, the *why *statement is 
completely different:
*"Waiting for next available executor on ‘NodeWithTestLabels’"*

The method *Queue.Item#getAssignedLabel() *from the Jenkins API, on the 
other hand, will return the actual label that the queued build is 
expecting: *MyTestLabel.*


By all means, the *Queue.Item#getAssignedLabel()* consistently provides the 
information I need, which is the label for which the pending build is 
waiting, regardless of whether there are no matching nodes or if the 
matching ones are busy.
The *why* attribute of the REST API is a mere human-readable string with 
often insufficient information.

So, is there any way of getting that information using only the REST API?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/18afa5d6-ff9c-48ad-9deb-03923a00585b%40googlegroups.com.

Reply via email to