4
votes

I have two agents that can build my configuration. I've set up two because I sometimes need to do two simultaneous builds.

How can I set build agent priorities to force TeamCity choose specific agent if both are idle and available?

Now it chooses agent randomly or by some unknown factors...

3

3 Answers

4
votes

You can filter which agents are used but I'm not sure you can specify which idle to agent to use.

If you are worried about TeamCity using the fastest agent it should do this automatically.

The Teamcity documentation states the following.

When there are several idle agents that can run a queued build, TeamCity tries to select the fastest one as follows:

  1. If no builds have previously run on agents, the CPU rank is used to select an agent.

  2. If builds have previously run on agents, the estimated build duration for the given build configuration is used to select an agent. The estimate is made based on the heuristics of the latest builds in the history of the build configuration; for estimating, the execution time of the more recent builds has more weight than that of the earlier builds. Personal and canceled builds are not taken into account, neither are any individual builds whose duration differs significantly from the rest of the builds for this build configuration.

2
votes

Now it's possible to configure agent priorities with help of the plugin. Please enjoy ;)

1
votes

You can specify that it uses a build agent using the Agent Parameters.
For example you can specify the build agent name (using "system.agent.name") or state that you want to only use build agents with a TeamCity CPU benchmark (say of 400) using: system.teamcity.agent.cpuBenchmark is more than 400.