Search code examples
teamcityagentteamcity-9.0agents

How to isolate multiple Teamcity agents from getting picked up by a specific job


I would like my build job to not build on specific teamcity agents and there is no common pattern for the build agent names. Is there a way I can isolate multiple agents from getting picked up by a single job.

For example I can make sure that the build job does not pick up 1 agent using the following parameter.

teamcity.agent.name 

does not match

agent-001

How can I similarly tell the teamcity job to not run on the following agents as well.

"123-agent"
"my_agent"
"test_agent"
"agent_do_not_use"

I cannot use the same parameter, teamcity.agent.name with does not match for multiple agents. Can you all teamcity experts help me out here please on what is the best way to achieve this.


Solution

  • You can add agent requirement with "does not match" condition which accepts regular expression and set it to: 123-agent|my_agent|test_agent|agent_do_not_use

    Using an agent requirement based on presence (or absence) of a specific property coming from agent's buildAgent.properties file would probably be a better solution to using agent names in the requirement.

    Alternative means to manage agent's compatibility are: use agent pools and use agent's Compatible Configurations set to a limited set.