Incompatible agent after adding an env variable build parameter

I want to pass Git branch name to my powershell build script.

  1. So I created an environment variable branch on the agent - and it's indeed available from Powershell

    > $env:branch


  2. Then I went to "Edit Configuration Settings -> Build Parameters" on TeamCity and added an environment variable env.branch there, with value (it seems there's no way to remove the "env." prefix but I assume it's fine)

  3. Then I restarted Build Agent Service (..and also rebooted the machine when service restart didn't seem to help).
  4. 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
  5. 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: defined in Build parameter: env.branch"

What am I missing?


Please sign in to leave a comment.