TeamCity Rest API - launch custom build

I am trying to call a custom assembly for a project passing in a specific modification of Id, as mentioned here .

eg httpAuth/action.html?add2Queue=bt27&modificationId=3605

This works great. However, I need to be able to get a modification of the last successful build. I do not see or mention this in the rest of the api docs.

I can get buildId from the last successful build, but changeId is not enabled

eg httpAuth/app/rest/buildTypes/id:bt27/builds/status:SUCCESS/number

Does anyone know how to get the changeIds list from the rest of the api?

+4
source share
2 answers

You can get all the builds for a specific project or build the configuration as follows:

 http://yourserver/app/rest/buildTypes/id:your_project_id 

You can filter these results to show only the latest successful builds as follows:

 http://yourserver/app/rest/buildTypes/id:your_project_id/?count=1&status=SUCCESS 

Use a script to load href from the assembly returned by the above URL, and you can get the lastChanges element, which always contains the identifier of the last change.

Then you can send the link below to invoke the assembly, which will only include changes to this identifier:

 http://yourserver/app/rest/action.html?add2Queue=your_project_id&modificationId=000000 

Note: The ID attribute in the lastChanges element is the one you want to use as the modification identifier. However, this is not the actual change identifier of your VCS. This is the internal identifier of the City Team.

+1
source

You can get a list of changes using the url http: // buildserver / httpAuth / app / rest / changes . You can find more information in the REST API.

0
source

Source: https://habr.com/ru/post/1334751/


All Articles