Rest API - Trigger build for change

Answered

Hello,

is there a way how to trigger a build for a specific change via the Rest API? I've found only option for the branch.

Thanks

0
2 comments

Or maybe better solution for my case - is possible to provide buildId and do rerun of this build with the same parameters via the api?

0
Avatar
Fedor Rumyantsev

Hello Michal!

Speaking of running the build on a specific revision, here is an example of build trigger via REST API specifying the exact revision (taken from https://www.jetbrains.com/help/teamcity/rest-api.html#RESTAPI-Buildnodeexample):

<build>
  <buildType id="buildConfID"/>
   <lastChanges>
    <change locator="version:a286767fc1154b0c2b93d5728dd5bbcdefdfaca,buildType:(id:buildConfID)"/>
  </lastChanges>
</build>

Unfortunately, it appears that we do not support build rerun via API; you can, though, fetch the build that has failed via /app/rest/builds/.., then parse out the parameters/revision and populate a new build request for the same effect. 

Finally, there is also retry trigger (https://www.jetbrains.com/help/teamcity/configuring-retry-build-trigger.html); while this is unrelated to the API, perchance this could also prove useful to you.

Please feel free to elaborate on what you are implementing and I will try to assist further.

0

Please sign in to leave a comment.