TFS release management build agent is not available - tfs

Recently I was able to configure a build agent on my laptop and queue a successful build on TFS.
Then I tried to switch to a build server VM. I created a service account with the same rights as my account I was using from the laptop and configured a new build agent on the machine to use the service account and the same pool and started the agent.
When I log into TFS I can see the agent running in the correct pool, and it is green. So I disabled the agent from the laptop, so it would use the new agent on the build server. However, when I queue a build to the pool, the message displays "all possible agents have been disabled". So my new agent is in the pool and enabled, but when I queue a build it is not seen as a possible agent.
How do I make the new agent pick up the request to queue a new build? I verified it's running as a service on the build machine.

Please make sure the service account is a domain account and is part of “Agent Pool Service Accounts” group in TFS under your Agent Pool.
Then check the capabilities, and make sure the agent capabilities match the one set in the build definition. In addition, private agents give you more control to install dependent software needed for your builds and deployments. You can compare with you laptop, to check if there are any necessary dependent software misinstalled.

Related

Waiting for an available agent after trying to send a build to a new Build Server

I just created a new Build server and added it to an existing Queue, I turned off the other agents in the queue so that this new build server would get the job. I sent a very simple .NET build but the build window says "Waiting for an available agent"
So I get it, I must have missed installing something on the build server. So when the job is submitted it's looking for an agent that can satisfy the "capabilities" How can I see that what capabilities the job needs so I can see why it's stuck?
As far as I know, if the agent capabilities couldn't meet the build demands, it will show the warning message at the build result or queue time.
For example:
You could try the following points to troubleshooting:
Navigate to Local machine->Service and check if the Visual Studio Team Foundation Background Job Agent is running on the TFS application tier server.
You could start or restart this service.
Make sure the account that the agent is run under is in the Agent Pool Service Account role or Project Collection Build Service Accounts and the account is a domain account.
TFS2015 -> Agent Pool Service Account
TFS2017 TFS2018 ->Project Collection Build Service Accounts
Change another available account for agent service, restart the service.
3.Restart the whole TFS server and check if this do the trick. Need some time to wait.
Here is another ticket with the similar issue, you could refer to it.
Hope this helps.

How do I set up a dedicated TFS build server in TFS 2018?

We are using a server running Windows Server 2012 R2 for our TFS work item management and source control.
But we want to set up a dedicated Build server.
We are running TFS 2018 Update1.
I've downloaded the latest available Build agent and ran the script 'config.cmd' from the dedicated Build Server.
In previous versions of TFS you were at least supposed to run the TFS Installation Wizard if I'm correct to configure the Build Service. But this changed since TFS 2015.
But where can you see that my dedicated server (that I used to run config.cmd) is actually used for executing the Build process?
I cannot really find information on how to install and configure multiple servers for running TFS.
as far as I know running the config.cmd is enough. The machine where the script is executed will then register with the server instance - during the configuraiton you had to specify the TFS Server URL right?
On the Server side, you can go to the Agent Pools (where you initially downloaded the Agent Configuration). After clicking on the Agent Pools on the left-hand side you should see all Agents registered to that Queue. To which Queue your agent belongs was as well specified during the configuration on the agent itself as part of the config.cmd.
If you want to add more agents, you can simply run the config.cmd on other machine and register your agent with the same server instance. It is even possible to have more than one agent on the same physical hardware if you want that.

VSTS private agent does not removed

I was using vsts private agent vsts-agent-win7-x64-2.123.0.zip with my proj1 on Computer1 with agent name Computer1. After some period of time I removed a whole project from VSTS. Then I was trying to remove agent config like that 'config remove', but had got error
VS800075: The project with id 'd2df8515-d69b-4a5d-96bf-93872a837d25' does not exist, or you do not have permission to access it.
So I decided to setup agent without removing config. ofcause it wasn't succeed.
Then I installed new version of vsts private agent 'vsts-agent-win7-x64-2.126.0.zip'. It didn't help. Same errors with configuring and removing. After all of this I comletely delete all files in folder and install new agent. I register new agent with same name to new project proj2. Console output was succeed, service started, everything seemed to be ok. But agent didn't appear in VSTS after 30 minutes.
It was strange. I tried to remove agent again, but got this:
Сбой: Удаление агента с сервера
Moved Temporarily
Service has been deleted, but register agent still not available. It tells me to remove agent before.
Does anyone know how to delete agent and register it again in such situation?
In the agent folder, make sure you can see hidden files, delete the .agent and .credentialsfile, then call config remove again. This should remove the service from your local machine and will allow you to reconfigure the agent.
You can also extract the agent to a new folder and perform a clean installation after the service has been de-registered
If the agent is still registered int he agent pool, you can use the little X button to the right of the agent int he Agent Pool screen on VSTS (may need to maximize screen for it to become visible) to remove the agent from VSTS as well. be sure to remove it from the Agent Pool as removing jus from the Agent Queue will not delete the agent from the account completely.
If you go to settings of your account --> Agent Pools you can then view the configured agents per pool. Your private agent is probably in the Default pool if you didn't specify a custom pool. Behind the agent name is a X that you can use to remove the agent.
After successfully removing the agent, you can reinstall it on your local machine. Make sure to run your PowerShell window as an Administrator since that's required to configure a Windows Service.

TFS build/release agents "update all agents" is not updating the agents for TFS on-prem 2017

For on-prem TFS 2017 when I try to update all agents in the agent pools, the update does not happen. I see the same old agent version.
Build servers typically do not have internet connectivity.
Is internet connectivity a pre-requisite for updating on prem build agents?
I had to download the new agent for a machine where I have internet and then copied the files over to a new folder in the build machine and reconfigured the agent from this new folder. After this is done I had 2 agent services - 1 pointing to older folder and 1 pointing to new folder. The service pointing to old folder was started and the new service was in stopped state. Stopped the old service and started the new service.
Is the process different for updating agent version for on-prem TFS?
Even if you have Internet connection, the update may not work.
According to Daniel Steiner there are 2 kinds of agents:
Windows specific agents (version 1.x)
cross platform agents (version 2.x)
In TFS 2017 the Windows specific agents (version 1.x) are deprecated. Thus they won't be updated from the agent queues admin area. So you have to download the agent from tfs (or github) and install it yourself. After initial installation/configuration the agent updates via tfs should work again. It would have been cool if they automated that process or at least said what to do in tfs.
Unfortunately the official docu does not make the whole issue clear enough.
Yes you need internet connectivity for updating on prem build agents.
Each agent automatically updates itself when it runs a task that
requires a newer version of the agent. But if you want to manually
update some agents, right-click the pool, and then click Update all
agents.
All build agents within the selected pool will go offline temporarily and then come back online as soon as they are updated.
Which you have done is manually adding a newly version agent, not updating the agent. There are just two agents in your build server,so you had two agent services.
More details about update agent in on-premise TFS server, you could refer below tutorials:
Updating Your Team Foundation Build Agents
Upgrading TFS 2015 Build Agent

Create Queue and Download Agent means in TFS 2015 (on premise)

Trying to make my CI/CD work using TFS. Have to overcome some of this user role setup. Also not really getting my head around the terminology and the workflow (kinda different with how Jenkins works) and at the same time I have to figure the myriad of TFS versions(2010/2012/2013/2015/2017) and the online Visual Studio team services. I have to unlearn what I already know somehow, thus my basic questions:
What are agent queue? What are pools? (when i click create queue, it will ask me to create new pool)
What does "Download Agent" means? I thought this agent will be installed on the server side like a plugin that you install in Jenkins.
I think this might help clarify:
An agent pool defines the sharing boundary for all agents in that
pool. In TFS, pools are scoped across all of your Team Foundation
Server (TFS); so you can share an agent pool across team project
collections and team projects. In Team Services, agent pools are
scoped to the Team Services account; so you can share an agent pool
across team projects.
An agent queue provides access to an agent pool. When you create a
build or release definition, you specify which queue it uses. Queues
are scoped to your team project in TFS 2017 and in Team Services, so
you can only use them across build and release definitions within a
team project.
An agent in TFS / VSTS does work (like a build or a release). Microsoft offers agents they host if you are using VSTS. Alternatively, you can setup your own agents. For example, if you need to run your build on a particular machine because it has some needed items to do compilation or you're using TFS and can't use the hosted, you'd need to download the agent and configure it on a machine. You can have multiple agents on one machine. I'd recommend not installing an agent on the same machine as the TFS application tier if you're working with an on premise installation.
The official tutorial which involves a lot of aspects about Team Services and TFS. Most of the concepts is the same in /2013/2015/2017 and Team service. You just need pay attention to the support version under the topic such as below screenshot:
An agent queue provides access to an agent pool. When you create a
build or release definition, you specify which queue it uses. Queues
are scoped to your team project in TFS 2017 and in Team Services, so
you can only use them across build and release definitions within a
team project.
More details about agent queue and agent pool, you could refer this link: Agent pools and queues
each queue can use only one agent pool.
This is why when you click create queue, it will ask you to create new pool.
For TFS2015, you are using the private agent.
An agent that you set up and manage on your own to run build and
deployment jobs is a private agent. You can use private agents in Team
Services or Team Foundation Server (TFS). Private agents give you more
control to install dependent software needed for your builds and
deployments.
You could use the download agent to Deploy an agent on Windows. And one of the most commonly used scenes of the "Download Agent" is when you are installing multiple private agents on the same machine.

Resources