Let's say I trigger build by sending GET request to /job/awesomesauce/build
. Is it possible to retrieve id of triggered build?
I'm aware I can try to access /job/awesomesauce/lastBuild/api/json
, but that would give me erroneous information in case there are multiple builds running at once. Additionally, there seem to be slight delay (few seconds) before it gives me information about currently running build.
I had to do this sort of thing, and here is a workaround I used: I had a dummy parameter that I passed to the build (in my case it was BUILD_ID of another build; in your case it may be a timestamp), I then queried and parsed both the build queue api ([server]/queue/api/...
) and the regular api (in case the build has finished) for the build containing the appropriate parameter value.
In the http response header "location", you can get the queue item id. Then you can poll /queue/item//api/json to get its executable number, which is the build id.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With