Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS 2017 - Build agents priority and order

I have a pool with 10 agents. I have noticed that usually only some of them are used, and others still there have hardly ever been used.

I am wondering if is there a way to say to TFS to use all of them? For example, something like TFS grabs them based on the order. At the first time uses the number 1, then 2, 3. After using the agent it puts the agent to the end of the queue. So, before using number 1 again TFS would use all the numbers first.

That would be very good to have that logic in place to have the best use of all the agents we have in place.

like image 323
Janissetti Avatar asked Sep 14 '17 21:09

Janissetti


People also ask

Can you deploy multiple build agents one machine?

Yes you can run multiple agents in a single VM. Make two directories say Agent1 and Agent2, extract the agent in each one of them and configure them with different names against your VSTS/TFS account. It should work out of the box.

How do I specify agent in Azure pipeline?

Navigate to the capabilities tab for the agent: From the Agent pools tab, select the desired agent pool. Select Agents and choose the desired agent.

How do I add agents to agent pool?

Navigate to Project settings, Agent pools. Select your agent pool and choose Update all agents.


2 Answers

Just as Daniel said, they don't need to be rotated. If some of them are not required, you can get rid of them.

However, you can set Demands in your build definition if you want to use a specific agent every time.

In the build definition, under General, add the Demand Agent.Name and set it equal to the name of the build agent under the value column, or add the custom demands (for example, use USER CAPABILITIES) to identify the specific agent. This will ensure the build is serviced by only this agent.

So, you can create different build definitions to use each of the agents.

Please reference this article for details: Build vNext, distributing load to different agents.

However, we can not achieve that for now. There is a user voice request here for the feature. You can go and vote it up to achieve it in the future.

like image 90
Andy Li-MSFT Avatar answered Oct 23 '22 06:10

Andy Li-MSFT


I wondered about the same thing. The cleanup process seems to leave artefacts from time to time. With the amount of builds we run, the servers tend to get low on space eventually (even though we wrote our own cleanup utilities).

It seems that there is a method to the TFS madness: VSTS Build Agent Selection Demystified

After discussing this with some folks at Microsoft, it turns out that the selection routine works something like this – when a new build is queued:

  1. Select all build agents that match the specified demands
  2. Sort the results by the clustered index on agent name

Translation: The build agents are selected in the same order in which they were registered with VSTS. I suppose that’s a simple approach, but not the one that I was expecting.

like image 4
Daniel Morritt Avatar answered Oct 23 '22 06:10

Daniel Morritt