How to store build version info in VCS

I have a proprietary build system that uses an XML file to store version information in Perforce. We are moving to TeamCity, but want to retain this file. In my system, I update the XML file and submit it, then start the sync using the changelist of the XML checkin. In TeamCity, using agent side VCS, I can do this as a step in the build process but the changelist used for the build is now out of sync with the version file. What I would like to do is get the TeamCity generated build number, use it to update my XML file in Perforce, and then let TeamCity do the sync using my new changelist.  Is it possible to write a plugin that will allow me to do this?

Comment actions Permalink

Hi Kerry

I'm sorry for late response to your question.

I suppose it can be done if you split the tasks to two build configurations.
First configuration updates version file in Perforce. You can launch it by Run Custom Build dialog, and edit version right in TeamCity UI.
Second configuration performs the build over latest changeset. Also you can automatically change its build number right from the build script, see Reporting Build Number page.


Comment actions Permalink

We are in a similar situation, and I want to follow Michael's idea, but add some automation to it. We want to have a manually-triggered build that submits the version file to Perforce and triggers 3 other builds automatically with the changelist number of the submitted version file (seems like I'd have to extract the changelist number from the output of "p4 submit" command). Is the best way to trigger the 3 builds through REST API as described here? Given the caveat, is it best to have a script that loops until the changelist is detected by TC, so the modification id is available or is there a better way to implement the REST query? Thanks.


Please sign in to leave a comment.