Starting a new build trough REST api
Hey,
I've been browsering the rest api plugin sourcecode, and found the syntax for all the different queries I need to extract the data from teamcity that I need.
Except one
I can't seem to find the url which lets me start a build of a certain buildconfiguration, and then gives me the buildnumber back, so I can track it's progress as it goes from the queue, to a buildagent, to being succesfully completed.
Does anybody know if the REST api will already let me do this?
Thanks, Lucas
Please sign in to leave a comment.
Lucas,
REST API does not yet support starting of builds. We certainly plan to add the ability.
For now, you can use non-REST approach described in the doc.
Another current possibility is to branch the REST API plugin for yourself and add the logic you need (and maybe send us a patch later).
Actually, just starting a plain build is quite an easy task, but the API should cover all the abilities of Custom Build Run dialog, and more.
One more note: as starting a build just puts it into the queue and build number is assigned to the build on its starting, most probably you will not be able to get the number on start build request. An internal id can be returned back that can later be used to get the build.
Hey Yegor,
Being able to get some token when starting a build, that can later be used to get the actual buildnumber once it has started would work great.
I was hoping to stay out of custom plugin development though , we'll see how realistic that is. Hopefully I'll be able to use the non-REST api
(without the token stuff offcourse, but it would already be quite nice if I can just start it), however I do need to start it at a specific revision.
The documentation says I could use:
Lucas,
TeamCity can only start builds on the changes detected by TeamCity. (I mean if the change was not detected, there is no way to start a build for it).
You can list the detected changes via REST. e.g. use the request:
http://<server>/app/rest/changes?project=id:<internal_project_id_like "project25">
the "id" of the "change" element would be that internal modificationId