Do we need to restart TFS Services periodically - tfs

We have TFS 2013 & TFS 2017 environments. For increased stability is it advisable to restart the Windows TFS Services (i.e. Visual Studio Team Foundation Background Job Agent, Team Foundation SSH Service) on periodic basis i.e. every weekend (to recycle the processes and memory threads)
My understanding is that this is not needed, however wanted to confirm it.

No, it's not needed to restart TFS Services periodically. But if there is some change, or problem, you could try to restart the service. For example.
After you install new software on a build agent machine, you must
restart the build agent service for the new capability to show up in
the pool so that the build can run.
If you change the password of the account that running the service, you need to update the logon information of the service and restart it.

Related

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.

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.

TFS release management build agent is not available

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.

Using Hosted Pool from TFS On-Premise

Is it possible to configure an on-premise TFS 2015 (Update 2) instance to make use of the hosted agent pool in a Visual Studio Team Services account?
All our builds / releases are currently done in-house, but to simplify the process of automated testing using clients and services hosted in Azure, we would like to move to VSTS-based agents (initially just for the release tasks, but possibly for build tasks later on).
The real desire here is to have our automated tests run outside our local network so our connection is not saturated with all the chatter of set-up / test run / tear-down against our cloud-hosted applications. These UI tests happen as part of our release process (using TFS Release Management).
I'm not 100% sure that configuring Releases to run on a hosted agent is the right approach to the problem, but it's what we're investigating for the time being anyway.
Hosted Pool currently works only with VSTS.
The only option for you at this point of time is to setup a VM with VSOAgent and configure it with TFS On-Prem. This will require your TFS to be exposed to internet (or just to the VM) so that the agent on Azure can configure itself.
Source - I am a Dev for the Hosted Pool Service.

Resources