Just a quick post on accessing TeamCity REST API from PowerShell. Why would you want top do this? Well in this particular eample I will be using PowerShell to access the build change list from TeamCity. One would think that it is something trivial (and it really isn’t too complex) that would be available out of the box but it isn’t.
First how can we call the REST API from PowerShell? It turns out that is quite simple:
This will load the changes response into an XML document. From here you can look trough each change and load the change details. This will contain a comments node which is the check-in comments the developer provided with the commit.
The TeamCity locator string can also include other parameters which are documented here. The documentation is unfortunately not comprehensive and I could not find a way to get a list of changes from the last pinned build. I think this might require an extra call to find the build id for the last pinned build and provide a range in the locator string. Homework for you the reader. ;)
Below is a more complete example of how to get the changes for one build. This will include all the comments for the commits since the previous build. It would probably be more useful to include all the changes from the previously pinned build.
I hope this gets you started adding some cool features to your builds. Hopefully I will find the time and cover some of the deployment side scripts I have built using
psake there are some cool features I would like to talk about.