-2

Assume a TFS incremental build definition and build agents BA1 and BA2. Assume that the last two executed builds were for commit C1 in branch BR1 on build agent BA1 and for commit C2 in branch BR2 on build agent BA2. Assume that the difference between BR1 and BR2 is large.

Now a new build is requested for commit C3 in branch BR2. Typically sizeof(C3-C2) << sizeof(C3-C1). So to get the smallest amount of recompilations the build should be executed by the build agent that built C2, i.e. by build agent BA2.

Unfortunately this is not how TFS selects build agents. Is it possible to tweak the TFS build agent selection as described above?

1 Answers1

0

If you mean only get the new added/changed sources and build with the specific agent for the next build, then try below things:

  1. Make sure the Clean option is disabled (Clean set to false in Get sources step). Please see Clean the local repo on the agent for details.
  2. Set Demands for your build definition, please see How to send TFS build to a specific agent or server enter image description here
Andy Li-MSFT
  • 28,712
  • 2
  • 33
  • 55
  • Yes, but I also want TFS to dynamically find out that the best build agent to run my build is agent BA2. Why? Because the changes from BR2/C2 to BR2/C3 are smaller than from BR1/C1 to BR2/C3. Why? Because the workspace on BA2 already has a checkout, and build, of BR2/C2. Not only will the checkout of BR2/C3 on BA2 be quicker than on BA1 but also, and more important, the subsequent incremental build will be quicker. I do not want to bind a build definition to a specific agent, and hence the agent to a specific branch, because this results in many definitions and suboptimal use of my agents. – Peter Jaspers Sep 24 '18 at 16:14
  • 1
    @PeterJaspers Unfortunately there isn't such a built-in feature for now, you could submit a user voice on https://visualstudio.uservoice.com/forums/330519-team-services to suggest the feature. – Andy Li-MSFT Sep 25 '18 at 01:46
  • As suggested by Andy, see [visualstudio.uservoice](https://visualstudio.uservoice.com/forums/330519-azure-devops-formerly-visual-studio-team-services/suggestions/35522314-select-a-tfs-build-agent-such-that-it-minimizes-in) – Peter Jaspers Oct 03 '18 at 17:58