2

I'm trying to setup Standard Lab Environment with TFS 2012 utilizing Build-Deploy-Test workflow. I setup test controller and test agents but when the LabManagement workflow starts executing I get an exception on RunDeploymentTask activity

Initial Property Values
BuildLocation = \\S0503TFS2T\TFSPlayground\ConsoleApplicationBuild\ConsoleApplicationBuild_20121210.23
DeploymentScriptDetails = agent1 | "$(BuildLocation)\Deploy.bat" $(BuildLocation) | c:\Env
LabEnvironmentUri = vstfs:///LabManagement/LabEnvironment/4
MaxWaitTime = 00:30:00
ThrowOnError = True
UseRoleForDeployment = True
Deployment Task Logs for Machine: win7testagent1
 Access is denied
 Exception Message: Team Foundation Server could not complete the deployment task for machine 'win7testagent1', script '"\\S0503TFS2T\TFSPlayground\ConsoleApplicationBuild\ConsoleApplicationBuild_20121210.23\Deploy.bat"', arguments '\\S0503TFS2T\TFSPlayground\ConsoleApplicationBuild\ConsoleApplicationBuild_20121210.23' and working directory 'c:\Env'. (type LabDeploymentProcessException)
Exception Stack Trace: 
Server stack trace: 
   at Microsoft.TeamFoundation.Lab.Workflow.Activities.RunDeploymentTask.ExecuteDeploymentTask.RunCommand(AsyncState state)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]: 
   at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
   at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, MessageData& msgData)
   at System.Action`1.EndInvoke(IAsyncResult result)
   at Microsoft.TeamFoundation.Lab.Workflow.Activities.RunDeploymentTask.ExecuteDeploymentTask.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
   at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

Apparently, this is security issue, that i cannot get over it Here's how this process is explained by MSDN:

The build-deploy-test workflow starts a build, and then gets the deployment scripts. The build definition copies the build files to the drop location. The workflow runs each deployment script in the working directory of the specific machine or machine role that the script is assigned to. Each deployment script retrieves build files from the drop location. Each deployment script copies or installs the specified build files onto machines in the lab environment.

At this point the problem shows up - the workflow runs each deployment script in the working directory of the specific machine.

Both machines are in the same domain the user that runs the Build service is also in the administrators group in the remote machine. I have even shared the remote folder where the workflow is supposed to copy the files/script with everyone in the network but no luck again.

I'm doing something stupid that driving me crazy - any help or thoughts are greatly appreciated!

Best, Rado

Jonathan Nixon
  • 4,940
  • 5
  • 39
  • 53
  • 1
    What is the account that the test agent is running as on win7testagent1? Does that account have permissions to the build folder or anything else you are using in your deployment script? – Ed Blankenship Dec 12 '12 at 16:15
  • the test and build agents are running with the same domain account as the test controller. – Radoslav Minchev Dec 12 '12 at 19:48
  • Does this work if you replace your deployment script to be something like "dir /s". Trying to narrow down on what is causing the failure. – allen Jan 30 '13 at 03:41
  • Well, I took another route. In my build-deploy-test scenario I used testsettings file with distributed testing infrastructure behind it to make the deployment and tests afterwards. What i do is: Build the code with Team Build and DefaultTemplate. Inside the Process tab of the template I specify testsettings file - which describes the test machines (Test Controller / agents). – Radoslav Minchev Jan 30 '13 at 08:09
  • When the Workflow build get to the point to read the test settings file the control is given to the Test Controller. In the testsettings file you can specify setup and clean script. I'm using the setup scripts to deploy the necessary assets to the various test agents. I use the clean scripts to wipe out everything from the test agents then. – Radoslav Minchev Jan 30 '13 at 08:10
  • I have the same error as yours. Please refer to the post: http://stackoverflow.com/questions/16542441/tfs2012-labdefault-11-template-deploy-scripts-fail-with-team-foundation-server/17779190#17779190 – Amitabha Jul 22 '13 at 02:55

2 Answers2

0

The following solution may fix your problem.

Steps: Create local account on the following server: local lab service account - tfslab

  1. tfs test controller server: create local tfslab account. Also configure the tfslab as lab service account in test controller configure console

  2. tfs test agent server: create local tfslab account and add tfslab to local admin group. Also update Visual Studio Test Agent service and Visual Studio Lab Agent Service to run as tfslab.

  3. tfs drop folder server: create local tfslab account. And add share read permission to tfs drop folder.

Details discussion see here.

Community
  • 1
  • 1
Amitabha
  • 1,693
  • 2
  • 25
  • 42
0

You may try to check %ErrorLevel% at the last of your bat script. I met the same error, and it turned out that that error was caused by exit code of robocopy, which returns 1 when the copy successes. I set the error code to 0, the issue was fixed.

raz0r89
  • 51
  • 4