標籤:
當我們使用TFS2015d的組建代理程式時,我們將組建定義加入代理池隊列中,但是代理可能無法完全下載我們在TFS代碼瀏覽器中看到的所有目錄,這肯定會導致編譯失敗呀!為什麼呢?
原因在於tfscompile這個帳號在某個項目的版本控制中,對某個源碼目錄沒有許可權
但是不可能啊,我們已經在根節點上給了許可權了呀,
是的,你的確給了根目錄所有許可權,但是仔細觀察你會發現,有個關於繼承的隱藏開關
如果某個目錄勾選了“關閉”,那麼這個目錄對TFSCOMPILE帳號就無權訪問,當然組建代理程式就無法下載咯。
因此,我們還是仔細點,挨個目錄檢查一遍。
當然,其實這個功能是有用的,比如我就是想讓TFSCOMPILE不下載某個目錄(比如branchs等)。
下面是老外對這個問題的解釋和解決方案:
I would like to share with you my last struggle with TFS. I received a call from a colleague about some problem with the ‘new’ TFS build. Initially I tough it is only a miss-configuration and that the solution will be trivial, but as you can imagine, it wasn’t.
The problem lied in the fact that build agent couldn’t retrieve the sources and the error message was not treated as such. You could only see logged a (workspace version -1) inside the Get Sources step, after stating that syncing the repository was done.
As a first thing, I tough about agent not having sufficient rights to retrieve the source code. After a quick check and making sure that the agent service user has sufficient rights to retrieve the code, I run my build again and I got the same result. Didn’t helped.
Next thing I checked all sort of settings, running the build on a different build agent on different server, running the agent under different account, making sure that permissions for the _work folder are setup correctly, all sort of things. I ended up realizing that if I moved the code from that Team project to another team project, suddenly my build agent was able to retrieve the code again. There where two things, or the project was corrupted or there where some security issues. Thanks to the Microsoft support assistance, I managed to get to the right solution. And guess what? It was a security issue.
For an unknown reason the permission inheritance was disabled on the folder that contained all of the interested branches.
By enabling this setting, I saw that there is a small change in the way build agents are authenticated against TFVC. XAML build agent identifies itself with the user that agent runs under. 2015 build agent in the other hand, uses a Project Collection Build Service group to do so. It is added automatically to the source code permissions tree, and in order to propagate it needs to have the permission inheritance switched on or you need to manually set rights for that user group.
Same goes for the owner of the local workspace created by the agent.
You can change those settings by editing the security for a give item in the source control.
Once this is done, you should see your build agent syncing the sources correctly.
Hi Adam, that’s exactly what I do mention in the post. Also in yesterdays post on MSDN ALM Blog (http://blogs.msdn.com/b/visualstudioalm/archive/2016/01/07/receive-an-error-when-resolving-a-bug-created-by-your-build.aspx) they do mention the same: new build system uses a service account. That service account should be automatically inherited, and in case the inheritance is set to off, it doesn’t happen. You can have inheritance set to off and still make it work by manually adding the above mentioned account and granting the necessary rights.
TFS 2015 Build Agent failing syncing the repository 擷取源碼 不全 失敗