I want to pass Git branch name to my powershell build script.
So I created an environment variable branch on the agent - and it's indeed available from Powershell
Then I went to "Edit Configuration Settings -> Build Parameters" on TeamCity and added an environment variable env.branch there, with value %teamcity.build.branch% (it seems there's no way to remove the "env." prefix but I assume it's fine)
Then I restarted Build Agent Service (..and also rebooted the machine when service restart didn't seem to help).
Then I checked if my variable is listed under "Agent Parameters" tab and it's indeed there (under "Environment Variables" section) although without the "env." prefix which is correct, I guess
- But every time I hit "Run" for the build, it only gets queued with "This build will not start because there are no compatible agents which can run it" message.
So after adding the env variable my agent gets listed "incompatible". Funny enough, it's still listed as compatible on the build configuration page
..but incompatible on the queued build page, where it suddenly says "Implicit requirements: teamcity.build.branch defined in Build parameter: env.branch"
What am I missing?