4
votes

I have two configured Build Agents on one Controller:

  1. Default Agent
  2. Default Agent1

I defined a build definition with the following Agent Settings:

Maximum Agent Execution Time:        00:00:00
Maximum Agent Reservation Wait Time: 04:00:00
Name Filter:                         Default Agent
Tag Comparison Operator:             MatchExactly
Tags Filter:

I created some BuildInformation Activities after the GetAgent Activity.

  1. String.Format("Build Agentname: {0}", BuildAgent.Name)
  2. String.Format("AgentSettingsName: {0}; AgentSettingsTags: {1}", AgentSettings.Name, String.Join(",", AgentSettings.Tags))

The Output is:

AgentScope (reserved build agent Default Agent1)
Build Agentname: Default Agent1
AgentSettingsName: Default Agent; AgentSettingsTags: 

So the AgentSettings.Name argument is set to "Default Agent", but paradoxically "Default Agent 1" is used.

Workflow: enter image description here

The strange thing is that sometimes the right Build Agent is chosen.

Is this a bug? What is my mistake?

It would be nice if someone could reproduce this behaviour too.

EDIT:

I have created an error feedback: https://connect.microsoft.com/VisualStudio/feedback/details/725885/tfs-2010-wrong-build-agent-is-choosen

2

2 Answers

2
votes

This definitely sounds like a bug if you are using the AgentScope activity. Have you logged in on the Microsoft Connect site?

Be sure you are using the AgentScope activity instead of the GetBuildAgent activity. I couldn't tell which one you were referring to from your question. The AgentScope activity is the one that actually reserves the agent based on the agent reservation specifications parameter details that you specify.

0
votes

When we provide the Name Filter = Default agent. It takes whichever agent is available and continue with that agent. If you want to choose any specific agent you can use a simple assign activity just after get the build agent to choose the specific build agent as used below.

agentsettings.name= "Agent name".

This will let you choose that build agent you wanted it to perform the task.

OR

You can use the functionality of tags in the build agent and use agentsettings.hastags.