Random pick TFS Build Agents - tfs

We have 1 Team Foundation Server 2017 Update 3 and 3 different build agents configuered. I've noticed that TFS picks the same build agent after when a project have to build. My question is there an option to pick a build agent randomly?

Unfortunately there isn't an option to set that to pick a build agent randomly.
For now, in TFS 2017 it picks the agent in the order that they are registered if the agents are all idle when a build is queued, rather than randomly selecting an agent.
Set Build Agent Priority is an good idea, and there is a user voice here to suggest the feature, you can go and vote it up to achieve it in future.
Currently as a workaround, you can set the demands in build definitions to force building with the specific agents.
To do that, you can reference below articles:
How to send TFS build to a specific agent or server
Build vNext, distributing load to different agents

Related

TFS CI across multible build agents (with batch changes option)

Exploring upgrade to on premise TFS 2017.3
We have a large project that takes about 20-30 minutes to compile. I'm planning on setting up multiple build agents on different servers to handle compilations on every check-in.
I enabled Continues Integration trigger and can run builds on all 10 agents in parallel (triggered by check-in). When I continue to check in files, the builds just put in queue waiting for agents to complete previous builds.
Selecting "Batch changes while a build is in progress" checkbox allows only one build to run even if I have 9 more agents ready for work.
How can I use all 10 agents and butch changes only when all of them are being used?
thanks.
This is the expected behavior, take a look at the behavior of "Batch changes" of Continuous Integration
Batch changes
Select this check box if you have a lot of team members uploading
changes often and you want to reduce the number of builds you are
running. If you select this option, when a build is running, the
system waits until the build is completed and then queues another
build of all changes that have not yet been built.
You can batch changes when your code is in Git in the project or on
GitHub. This option is not available if your code is in a remote Git
repo or in Subversion.
If you selected this option, then you will have to wait the build completed and queue another build. More details please take a look at the official link.

Manual intervention is not available in TFS-2018

I'm trying to find the manual intervention task in the release management of my on Prem- TFS
As per here this is available in TFS 2017. By May it's removed in the latest release?
I searched through the TFS marketplace, but no luck so far.
My TFS Configuration is 16.122.27319.1 (Tfs2018.Update1.RC1)
Could somebody help me to get this task in my release definition?
There are 3 types of phases or ("jobs"):
Agent
Deployment Group
Server (or 'agentless')
Manual intervention goes in a Server/agentless job. You probably have a standard Agent job in your release definition. You'll need to break your release up into multiple jobs: Agent (up to the point where you need a manual intervention), Server (containing the manual intervention), then Agent again.

How do you specify demands on a TFS Release?

Background: I'm using on-prem TFS 2015. I have two build agents. As part of my build and release process I want to run some PowerShell modules that are registered on one agent but not one the other. I've set up capabilities on the agent and demands on the build so that the build runs on a particular agent. But now I need to run the release and specify the same agent.
Question: How do I set up my release to run on a particular agent?
I found it. It's on the Trigger Tab. Select "Edit" pencil icon in Environmental triggers.
You can also edit it if you click on this:

TFS only releasing to the first agent in an environment

In TFS 2015 Update 2, I have configured seven release agents in one pool, separated into a set of logical environments using capabilities.
I also have a release configured with three environments defined to use the queue corresponding to this pool and demands specified to filter to the appropriate servers for each environment (1-Test, 2-QA, 4-Prod).
My problem is that TFS is only releasing to the first agent created that meets the demands. If I remove all demands in an environment I would assume it would release to every agent in the pool yet TFS still releases to only the first agent in the pool. If I disable that first agent, it will release to the next; but still to only one agent.
What am I missing?
I think you're misunderstanding what agents are for. The agent merely acts as an invocation mechanism for your deployment activities. You don't need one agent per environment or per server.
For example, if you need to run a PowerShell script on a machine, you use the "PowerShell on Target Machine" deployment activity. The agent will then use WinRM to tell the target machine what scripts to run. That agent can run PowerShell scripts against any machine.
Why would you want the release or build to select a different agent every time? I had always seen with TFS that the probability of a build running on the agent, where the last successful build for a specific build definition ran, is very high.
The only reason I think a build/release should run on a different agent every time is if the number of builds running at a same time requiring the same capabilities is more than one.
If you would like to test each of the agents then try disabling one agent at a time and run the build/release.

Why and when to have multiple build agents?

Consider TFS 2010's ability for a Build Controller to have 1+ build agents. Since builds are a subjective topic to the team/environment, consider an environment where builds are performed on commit/check-in. Each Project Collection will have 10+ Team Projects, but perhaps only 1 or 2 are being committed to in a day.
When should a TFS administrator consider creating a new build agent?
Do multiple agents run in parallel?
When a single agent is defined to a Build Controller, does it run serially?
MSDN states: "if you set up your agents to have specialized capabilities..." . What does this mean? A technology/platform differentiator? How can you setup your agents to have specialized capabilities?
How can 'tagging' build agents be used effectively in an environment where builds are (typically) performed on each check-in.
You use multiple build agents to support multiple build machines (I work currently with a build farm with 3 build machines - and thus 3 build agents - to distribute the load).
You also might want to have multiple build agents to be able to run builds in parallel. This is a nice feature to share resources, but a requirement when you start working with Test/Lab Management features.
With the capabilities: for example you can setup a build agent with version 1 of a 3rd party component, and a second build agent with version 2. With tagging you can specify in the build definition which build agent it will choose from out of the pool of build agents.
We use 2 build agents on the same machine at work, since we only have one build machine.
The first one handles our CI builds, and is tag with CI. The build definition for the CI build is set up to only use agents that have the CI tag.
The second one is for manually queued builds, mostly for the release branch builds.
I specialized the CI build agent, because it was not uncommon when we were preparing a new build for QA to have several developers check into the development branch, which would slowing down being able to release the build to QA.
One of our builds takes 9 minutes. Its nice that you don't have to be in the Queue behind it if you happen to deploy at the wrong time.

Resources