I'm not sure how easy it will be to add this functionality in the Jenkins API itself. As the build number is determined once the build is moved from the queue to one of the executors, it might be hard to return the build number as soon as the build is triggered. I looked around the code in Jenkins and it doesn't seem to be an easy fix. However I have authored a jenkins_api_client ruby gem which makes use of the new behavior of Jenkins' response to build POST requests.

In recent versions, jenkins returns a location header to the response of the build POST request. This location header contains the location of the queue item for the particular build. This queue item can be continuously queried until it is placed in one of the executors. Once the queue item reaches an executor, it is assigned with a build number.

I have implemented a neat solution here https://github.com/arangamani/jenkins_api_client/issues/88 which will optionally accept an argument on whether to return the build number and return the build number once it is obtained. The only downside is that if there aren't enough idle executors of another build for the same job is running, this call will have to wait until it obtains the build number. Which is why I made this optional so people can decide whether to wait or not.

Any comments on my implementation would be appreciated.

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/groups/opt_out.
 
 

Reply via email to