azure-pipelines-agent: Multiple agents on the same machine using tf.exe can lead to getting sources failure
A build is intermittently getting this error when fetching source from TFS:
2017-03-23T23:49:31.0591599Z ##[section]Starting: Build solution Roster.WebService.sln
2017-03-23T23:49:31.0591599Z ==============================================================================
2017-03-23T23:49:31.0591599Z Task : Visual Studio Build
2017-03-23T23:49:31.0591599Z Description : Build with MSBuild and set the Visual Studio version property
2017-03-23T23:49:31.0591599Z Version : 1.113.0
2017-03-23T23:49:31.0591599Z Author : Microsoft Corporation
2017-03-23T23:49:31.0591599Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613727)
2017-03-23T23:49:31.0591599Z ==============================================================================
2017-03-23T23:49:31.6529233Z Unable to determine the workspace. You may be able to correct this by running 'tf workspaces /collection:TeamProjectCollectionUrl'.
2017-03-23T23:49:31.8872843Z ##[error]Exit code 100 returned from process: file name 'tf', arguments 'vc resolvePath "$\My Development\Trunk\src\Rostering\trunk\Roster.WebService.sln" /loginType:OAuth /login:.,******** /noprompt'.
2017-03-23T23:49:31.8872843Z ##[section]Finishing: Build solution Roster.WebService.sln
Copied from https://github.com/Microsoft/vsts-tasks/issues/3853
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 84 (36 by maintainers)
Work is in progress to get a new agent that carries the updated tf.exe and dependency DLLs (pr https://github.com/Microsoft/vsts-agent/pull/1056)
On version 123 I am still having the issue, but I can add some details and a workaround that may be helpful to find this problem and get people back up and running again.
So here is the scenario as I have pinned down.
I too though it was random until I tracked the issue. Here is what mine did.
So my assumption here is the workspace is being created but not attached to something. I think it’s the cache based on MSDN Blog
which states “If the workspace mapping exists on the server, then your mappings cache file may need to be refreshed. Try running this command to populate/refresh the cache: tf workspaces /s:http://tfs-server:8080” Which is why I tried 8a mentioned earlier and is the workaround if implemented as below.
WORKAROUND:
In the powershell call “tf workspaces /s:http://tfs-server.com” before calling tf whatever.
The only other current “Workaround” we have is,
Here are the details for the questions asked.
Now I am not sure if the issue is caused by having VS2015 installed while using agents for 2017, looking at the prior messages, it looks like everyone having this issue is using this scenario, so that may be the root problem. Several people have said they have VS2015, and I am running tf from version 14 (which is VS2015, so confusing). That may be the key to replicate the issue.
This is my setup for tf.exe $tfsTool = “C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\TF.exe” so directly using 14.
Sorry for the long message, but I hope this is detailed enough and contains enough information to fix or workaround the problem. Personally I think if this is an issue using 2015 TF and 2017 agents, then there may need to be a workaround posted and not necessarily a fix, but a fix would be nice.
@Cristie - this issue is only tracking the error mentioned at the beginning of this issue
From a build, get sources with multiple agents can cause:
Unable to determine the workspace. You may be able to correct this by running ‘tf workspaces /collection:TeamProjectCollectionUrl’. 2017-03-23T23:49:31.8872843Z ##[error]Exit code 100 returned from process
That is an issue in tf.exe shipped with the agent
those are separate issues. let’s keep this thread focused.
@JamesNK I’m trying to think of some workarounds…
Assuming you run the agents as a Windows service (and not interactively from command prompt), one thing that could mitigate is running the agents as different service accounts. My best guess right now is that some race condition is stomping on some local file.
If you don’t have complex mappings, another thing you could try is specify the file name as a relative path. The agent will prepend the build sources directory (e.g.
C:\Agent1\_work\1\s
). Or use$(Build.SourcesDirectory)/relative/path/to/file.ext
.Also I’m planning to add support to opt-in to server workspaces, by setting a variable on the definition (something like
Build.TfvcWorkspaceType=Server
). I can add that to the next agent release if you want to try it, and see if the issue goes away. My thinking is XAML build supported side-by-side agents and this issue afaik wasn’t a problem.I’ll talk with VC folks again to see if they have ideas how to get to the bottom of this issue.