Kine's Info

What I found and what I know about Microsoft Dynamics NAV

TFS 2015 Build system - Build Agents

Agents of TFS 2015

In previous part we were I was describing the TFS 2015 build system and how to create your first build template. Today, I will describe how to prepare environment, where the build will be done.

Build environment

To run the own build process you need some PC, where you have all needed to do the build. You can choose to use some VPC, your workstation or another server, it does not matter. What you need for the build:

  • Windows compatible with the used NAV version
  • Correct NAV version installed (or you can install it as part of the build if you want)
  • SQL server compatible with the NAV version (on same server or different, does not matter)
  • PowerShell scripts - scripts needed for the build must be available on the server (or could be installed as part of the build/source code)
  • VSO Agent - the process, which will run the build for you

In case of NAV, you cannot use the Build agents available as part of the Team Services, because you need to install NAV on the machine. Thus it must be your own PC/VPC, but it does not matter if on prem or somewhere in cloud. It could be used together with Team Services.

I think that I do not need to describe how to create clean VPC with all the prerequisities, except the VSO Agent.

VSO Agent

When all is prepared and you need to install the VSO Agent on your build server, all you need is to open your TFS web portal and navigate into the Administration of your server, Agent pools tab, and select Download agent.

Download the agent, expand in somewhere and run the ConfigureAgent.cmd as admin. There you need to put few values to correctly configure the agent:

  • Name of the agent - it is on you how you will name it
  • URL for the TFS - enter the URL of the TFS server without the Collection part, e.g. http://tfs:8080/tfs or enter the URL of your Team Services
  • Agent pool - use the default if you do not want to create separate Agent pool. Agent pools could be used to create separate groups of agents for different purposes.
  • Path of the work folder - folder, where the source repositories will be saved and where all the processing will run. Put it on fast disc, it will help to keep the build time short (SSD).
  • Install the agent as Windows Service - I am answering NO here, because I want to run NAV test suite, which need GUI. If you will only build the NAV and not run the tests, you can install the Agent as Windows service and it will automatically start after restarts etc. If you do not install the agent as service, you need to log into the server under account under which you want to run the agent and run it manually each time the server is restarted (or script this somehow)
After you answer all questions, the agent is configured and started. Next time you can run the agent by starting RunAgent.cmd. Do not forget to run the agent as admin, else you will not have needed access e.g. when creating new NAV server instance etc.
 
The VSO Agent is not searching for PowerShell modules in the standard PSModulePath! If you need to use your own PowerShell modules, you can put them into Agent\Worker\Modules subfolder, or load them including full module path or in another way. This could make you headache, if you forgot about this. Another problem connected with this is, that the subfolder is cleaned up when the Agent is updated. You can update all your agents from the TFS Admin portal.
 
After you have at least one Agent up and running, you can queue your first TFS 2015 Build.
 

Agent Capabilities

In the Control panel, where you have downloaded the agent, you should now see the agent in the list. From there, you can configure it - enable/disable the agent, update the agents (context menu on the pool), enable autoprovisioning of the agents (don't ask me now what it is doing) and you can setup the capabilities of the agents. You can use the the capabilities to create "Name-Value" pairs, which than could be used for choosing correct agent to build the specific Build Definition (See the General tab section in previous part). The build will be running on  agent, which have needed capabilities defined as specified on the build template. In this way you can e.g. mark Agents for different NAV versions/builds/purposes (test, live, devel ...) - you do not need to create separate agent pools for this.
 
 
Now you have all needed to run your build. Next time we will look at how to run NAV Tests under TFS 2015.