
Display the short GIT version hash as build identifier in TeamCity

TeamCity is a Continuous integration and build management server from JetBrains.
As the first build step, create a custom script that reads %build.number%
, and uses service messages to append the short GIT hash programmatically.
Here’s an example using a bash script pasted right into the TeamCity GUI (Runner type: Command Line, Run: Custom Script):
GIT_HASH=%build.vcs.number% GIT_HASH_SHORT=${GIT_HASH:0:7} echo "##teamcity[buildNumber '#${GIT_HASH_SHORT}']"