Update build count and tag git code line automatically

TeamCity Enterprise 7.0 RC1 (build 21209)

We’re using TeamCity to do our builds:
• Pull the source code from git
• Building the obj
• Link w/ external libraries
• Post binary to our production server

The one thing we haven’t been able to work out is tagging the git repository. When we have a successful build I want to be able to build it again some time in the future, so I want to tag the code line in git. I'd like this tag to be generated automatically.

We use the following convention for our version numbers: “v<Major Revision – pad w/ zeros to 2 digits >.<Minor Revision – pad w/ zeros to 2 digits >.<Build Number – pad w/ zeros to 4 digits>” e.g.:

v03.02.0067

Each time we have a successful build, I’d like TeamCity tag the git repository with the resulting version number and increment the build count for next time:

git tag -a v03.02.0067



On the next build the tage would become:

v03.02.0068

Can I do this? If so how?!



Cheers,
Hugh
1 comment
Comment actions Permalink

You can setup VCS labeling on at "Version Control Settings" step of build configuration. Specify a desired label format in "Labeling pattern" field and don't forget to choose VCS roots to label (more details here http://confluence.jetbrains.net/display/TCD7/VCS+Labeling).

"Labeling pattern" itself doesn't support padding you need, but you can use parameter reference in the pattern and report parameter of any form from the build using service messages as described here: http://confluence.jetbrains.net/display/TCD7/Build+Script+Interaction+with+TeamCity#BuildScriptInteractionwithTeamCity-ReportingBuildNumber

0

Please sign in to leave a comment.