Daniel Beck resolved New Feature JENKINS-12827 as Won't Fix

Build numbers don't get assigned to queued builds, and for good reason: Between QueueSorter, QueueTaskDispatcher, and plugins like Set Next Build Number, this is impossible to determine before actually starting the build. Then there's the issue of canceling queue items – they don't (and shouldn't) use up build numbers, which this change would necessitate (or result in wrong results, as a specific build number could be queued and canceled again multiple times).

However, there's an easy API solution that considers that issue when triggering builds.

Trigger the build and check the headers:

$ curl -i --netrc http://jenkins/job/triggerable-remotely/build?token=ABC
HTTP/1.1 201 Created
Date: Wed, 21 May 2014 16:37:58 GMT
Server: Jetty(8.y.z-SNAPSHOT)
Location: http://jenkins/queue/item/25/
Content-Length: 0
Connection: close
Content-Type: text/plain; charset=UTF-8

Get the Location value, and check its API at e.g. /queue/item/25/api/xml (formatted for readability):

<waitingItem>
	<action>
		<cause>
			<shortDescription>Started by remote host xxx.xxx.xxx.xxx</shortDescription>
		</cause>
	</action>
	<blocked>false</blocked>
	<buildable>false</buildable>
	<id>25</id>
	<inQueueSince>1400690278070</inQueueSince>
	<params/>
	<stuck>false</stuck>
	<task>
		<name>triggerable-remotely</name>
		<url>http://jenkins/job/triggerable-remotely/</url>
		<color>blue</color>
	</task>
	<url>queue/item/25/</url>
	<why>In the quiet period. Expires in 38 sec</why>
	<timestamp>1400690328070</timestamp>
</waitingItem>

This contains all the information you could possibly want here. And once the build starts and a build number has finally been assigned, you get the build number and build URL:

<leftItem>
	<action>
		<cause>
			<shortDescription>Started by remote host xxx.xxx.xxx.xxx</shortDescription>
		</cause>
	</action>
	<blocked>false</blocked>
	<buildable>false</buildable>
	<id>25</id>
	<inQueueSince>1400690278070</inQueueSince>
	<params/>
	<stuck>false</stuck>
	<task>
		<name>triggerable-remotely</name>
		<url>http://jenkins/job/triggerable-remotely/</url>
		<color>blue_anime</color>
	</task>
	<url>queue/item/25/</url>
	<cancelled>false</cancelled>
	<executable>
		<number>6</number>
		<url>http://jenkins/job/triggerable-remotely/6/</url>
	</executable>
</leftItem>

As this feature is at least next to impossible to implement in a backwards compatible way, and has an easy, complete solution already, I'm resolving this as Won't Fix.

Change By: Daniel Beck (21/May/14 4:45 PM)
Status: Open Resolved
Resolution: Won't Fix
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to