0
votes

I have a simple TFS Gated Check-In workflow, that actually does not build anything - it is all about initializing the workspace and checking in the shelveset.

To avoid pasting the whole of the XAML code, I have created an approximation of the workflow using this online Graphviz sandbox. The DOT code is here and the workflow is:

enter image description here

I have skipped a few auxiliary sequences and the gated check-in is invoked for CheckInShelveset reason, of course.

In the build definition:

  1. The agent settings make the TFS always choose the same build agent, say torsvbuild10: enter image description here
  2. The source settings:enter image description here

Now the workflow seems to work fine - when I check in a file it triggers the build, the check in is accepted and I get the shelveset reconciliation dialog on my machine.

I would like to be able to inspect and manipulate the respective working directory on the Build Agent. And here I run into troubles. Please, observe:

PS C:\tfs\DFGatedCheckInTest2> $env:UserName
TFSBUILD
PS C:\tfs\DFGatedCheckInTest2> tf status /recursive /noprompt
There are no pending changes.
PS C:\tfs\DFGatedCheckInTest2> tf status /recursive /noprompt .
There is no working folder mapping for C:\tfs\DFGatedCheckInTest2.
PS C:\tfs\DFGatedCheckInTest2> tf status /recursive /noprompt /workspace:"1733_torsvbuild10;torsvbuild10$"
File name Change User                   Local path
--------- ------ ---------------------- -----------------------------------------------------------------------------------------------------------
$/DFDev/dkahl/SharpTopBranch/Build/2010/scripts
1.txt     edit   DAYFORCE\TORSVBUILD10$ C:\TFS\DFGatedCheckInTest2\Build\2010\scripts\1.txt

1 change(s)
PS C:\tfs\DFGatedCheckInTest2> tf status /recursive /noprompt /workspace:"1733_torsvbuild10;torsvbuild10$" .
There is no working folder mapping for C:\tfs\DFGatedCheckInTest2.
PS C:\tfs\DFGatedCheckInTest2> tf history /recursive /noprompt /stopafter:1 .
There is no working folder mapping for C:\tfs\DFGatedCheckInTest2.
PS C:\tfs\DFGatedCheckInTest2> tf history /recursive /noprompt /stopafter:1 "$/DFDev/dkahl/SharpTopBranch" /format:detailed
---------------------------------------------------------------------------------------------------------------------------------------------------
Changeset: 105815
User: DAYFORCE\mkharitonov
Checked in by: DAYFORCE\TORSVBUILD10$
Date: Saturday, October 25, 2014 10:15:45 PM

Comment:

  ***NO_CI***

Items:
  edit $/DFDev/dkahl/SharpTopBranch/Build/2010/scripts/1.txt

PS C:\tfs\DFGatedCheckInTest2> tf undo /recursive /noprompt /workspace:"1733_torsvbuild10;torsvbuild10$" .
TF14098: Access Denied: User DAYFORCE\tfsbuild needs UndoOther permission(s) for $/DFDev/dkahl/SharpTopBranch/Build/2010/scripts/1.txt.
PS C:\tfs\DFGatedCheckInTest2>

The workspace is created using the Build Agent machine account (torsvbuild10$). Subsequently, the shelveset is checked in using the same account. However, when I login to the build agent I am using a completely different account (TFSBuild). Because of this, I am unable to manipulate the workspace and its source directory. The only way to do so is through the workflow.

My question is - why is the build agent machine account used? I want it to be the dedicated TFS build account that we have - DAYFORCE\TFSBuild, but I do not see how to set it up.

We are using TFS2010.

2

2 Answers

1
votes

To change the account for your build agents to DAYFORCE\TFSBuild you'll need to use the TFS Admin console and adjust the settings. Here's the MSDN article that you need: http://msdn.microsoft.com/en-us/library/ms181712.aspx (I linked to the 2013 version since it has pretty pictures and it's much the same as in 2010)

0
votes

The build service will use whatever account that I is running under. If you want to use that dedicated build account you need to change the buildservice to run under it. It sounds like you are running the agent service under network service.