Capture the build number for a remote-triggered Hudson job?

Posted by EMiller on Server Fault See other posts from Server Fault or by EMiller
Published on 2011-01-15T02:35:41Z Indexed on 2011/01/15 2:55 UTC
Read the original article Hit count: 211

Filed under:

I have a very simple inhouse web app from which certain Hudson builds (on another server) can be triggered remotely. I have no problem triggering the builds, but I don't know how to capture the associated build number for later reference.

I'm using the buildWithParameters trigger, and the actual result of that call is just a mess of HTML - I don't believe it gives me back the build number.

I started down the path of pulling the whole build list for the job (via the api), and then attempting to reconcile that list against my records - but that's much more complicated than I'd like it to be. I also considered sleeping for a few seconds after launching the job, and then grabbing the latestBuild from the Hudson api - but I'm sure that's going to go wrong at some point (someone will fire off two jobs quickly, and I'll get the association wrong).

© Server Fault or respective owner

Related posts about hudson