tags:

views:

217

answers:

2

With a Windows 2008 Server, that is the Build Server (TFS 2010), that has 2 Build Agents, how do you configure these agents that use the same account, to use multiple workspaces ( or to stop it from using multiple workspaces) with the same paths?

Currently, the behavior i am seeing is IT is creating multiple workspaces, with the same user and the same paths. I have to manually delete the duplicate workspaces. a few build attempts later, more workspaces have been auto-created, and then fail to build because there are multiple workspaces with the same paths. Again, this is happening automatically, and having to delete workspaces manually every 10 minutes or so, is not an answer.

Thanks.

+1  A: 

(I'm not entirely sure if this answers the question, but...) IIRC you can configure the root working folder for each build agent. Then they are able to work alongside each other in their own workspace without any clashes.

Jason Williams
The above approach break my reference paths, unless I make them static (no templating), also, this does not resolve the multiple workspace issue. 2 Agents 3+ workspaces (im not sure why it keeps creating these)
@user264892: I'd strongly recommend using relative paths for all references - absolute paths are a killer. You *will* have a major problem with absolute paths at some point, and the longer you leave it the bigger that problem will be to solve. For me it works really well, so I don't care how many workspaces it uses. Does it matter that it uses 3 workspaces? Usually if I find myself fighting something to get my own way I eventually work out that I'm doing something wrong.
Jason Williams
Well, it does matter that its using 3 workspaces. Thats the error TFS is giving me. TFS creates multiple workspaces using the same paths. Again, this is automatic creation. I did not tell it to keep creating 3 (and now its at 5 ) workspaces per agent on my build server. the paths ARE NOT relative, but seem to be resolving via templating to the same path and then my builds fail because my builder user now has 3+ workspaces created that are the same. Can I stop TFS from creating workspaces automatically???
If you set the agents to use different root folders, and change your references to be relative, the workspaces won't clash. It wouldn't surprise me if it's creating workspaces to try to resolve the clashes ("I can't use that workspace, it's broken, so I'll create a new one. Damn it's in the same place...").
Jason Williams
Why would it try to 'resolve' hard coded references by attempting to create more workspaces? That is currently causing my builds to fail, not references. I am able to build the project successfully, until it creates another workspace. Then it throws the error of multiple workspaces. I agree that this will be issue when i merge/branch, but if i cant build , then m/b is useless. Can i cut off 'automatically create workspaces' ? Note, I have tired enabling only 1 agent, but i t still creates the extra workspace.
You *cannot run two build agents in the same working folder*, because their workspaces will clash/overlap. (I am hypothesising that the repeated creation of new workspaces may be a doomed attempt to generate a non-clashing new workspace. Repeated workspace creation doesn't happen if the build agents are configured correctly to use separate folders). However, *in order to use separate build folders, you must make your source code relocatable*, hence you need to make all references/file-paths within your code/projects relative.
Jason Williams
A: 

Each of your build agents should be using their own working directory. I have multiple build agents on a build server and when set up so, I don't have any issues with regards to workspaces.

The default working directory for a build agent is something like:

$(SystemDrive)\Builds\$(BuildAgentId)\$(BuildDefinitionPath)

So there should be different folders based on $(BuildAgentId).

LordHits
Trying this approach fails to resolve references. AS the projects themselves are looking for "C:\Assembles" for the references, and now they are at $(SystemDrive)\Builds\$(BuildAgentId)\$(BuildDefinitionPath)\Assemblies. A 2 hour google did not resolve the resolve that issue.
For your build definition, under the "Workspace" tab, are you referencing the locations of all your needed libs for your solution?
LordHits
A trivial change of "C:\" to "..\..\" (or whatever is required to make the path relative) will make your problems go away. If you don't you will be in a world of pain if you try branching, decide you need 2 copies of the code on your machine (e.g. to compare before and after builds when chasing a tricky bug), or simply find you really need to move the code to a D: or E: drive (e.g. in my previous company the IT dept gave us 9GB C: partitions. Madness, but our code had to go on D: as a result)... You couldn't google a solution to your issue because everyone uses relative paths.
Jason Williams