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?
If you mean only get the new added/changed sources and build with the specific agent for the next build, then try below things:
Clean
option is disabled (Clean
set tofalse
inGet sources
step). Please see Clean the local repo on the agent for details.Demands
for your build definition, please see How to send TFS build to a specific agent or server