TFS vNext Build:GetSources任务无法从访问受限的文件夹中获取文件 [英] TFS vNext Build: GetSources task does not get files from folder with restricted access

查看:81
本文介绍了TFS vNext Build:GetSources任务无法从访问受限的文件夹中获取文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们当前正在从XAML构建迁移到vNext(TFS2017)。
正常构建可以正常工作,但我们的LicenseManager的构建不起作用。
只能从某些用户访问包含LicenseManager源代码的文件夹。
因此,我配置了一个vNext构建代理,该构建服务在一个可以访问源代码的帐户上运行(就像我们对xaml构建所做的那样)。
我使用功能和需求强制在该代理上构建LicenseManager。

we are currently migrating from XAML build to vNext (TFS2017). The "normal" builds work fine, but the build for our LicenseManager does not work. The folder containing the LicenseManager source code can only be accessed from certain users. So I configured one vNext build agent, where the build service runs on an account that has access to the source code (like we did with the xaml build). I used Capabilities and Demands to force the LicenseManager build on that agent.

但是GetSources任务不会下载LicenseManager的源代码。
这些是GetSources任务使用的命令:

But the GetSources task does not download the source code of the LicenseManager. These are the commands that the GetSources task uses:

tf vc workspace /new /location:local /permission:Public ws_1_12 /collection:http://tfs:8080/tfs/DefaultCollection/ /loginType:OAuth /login:.,******** /noprompt
tf vc workfold /unmap /workspace:ws_1_12 $/ /collection:http://tfs:8080/tfs/DefaultCollection/ /loginType:OAuth /login:.,******** /noprompt
tf vc workfold /map /workspace:ws_1_12 $/TPA/BuildVNext/1.7 D:\b\a1\_w\1\s\TPA\BuildVNext\1.7 /collection:http://tfs:8080/tfs/DefaultCollection/ /loginType:OAuth /login:.,******** /noprompt
tf vc workfold /map /workspace:ws_1_12 $/TPA/LicenseMgr/dev/main D:\b\a1\_w\1\s\TPA\LicenseMgr\dev\main /collection:http://tfs:8080/tfs/DefaultCollection/ /loginType:OAuth /login:.,******** /noprompt
tf vc workfold /map /workspace:ws_1_12 $/TPA/DevTools/internal/BuildHelper/1.6 D:\b\a1\_w\1\s\TPA\DevTools\internal\BuildHelper\1.6 /collection:http://tfs:8080/tfs/DefaultCollection/ /loginType:OAuth /login:.,******** /noprompt
tf vc workfold /map /workspace:ws_1_12 $/TPA/DevTools/internal/ReferenceManager/1.9 D:\b\a1\_w\1\s\TPA\DevTools\internal\ReferenceManager\1.9 /collection:http://tfs:8080/tfs/DefaultCollection/ /loginType:OAuth /login:.,******** /noprompt
tf vc workfold /map /workspace:ws_1_12 $/TPA/DevTools/external/MsBuild/ExtensionPack/4.0.9 D:\b\a1\_w\1\s\TPA\DevTools\external\MsBuild\ExtensionPack\4.0.9 /collection:http://tfs.:8080/tfs/DefaultCollection/ /loginType:OAuth /login:.,******** /noprompt
tf vc get /version:178702 /recursive /overwrite D:\b\a1\_w\1\s /loginType:OAuth /login:.,******** /noprompt

除 LicenseMgr\dev\以外的所有文件夹将下载 main(访问受限的主机)。
但是,当我打开VisualStudio时,选择在构建过程中创建的工作区,然后选择获取最新,它确实会下载代码而没有任何问题。

All folder except 'LicenseMgr\dev\main' (which is the one with restricted access) get downloaded. But when I open VisualStudio, select the workspace that was created during the build, and select "Get Latest", it does download the code without any problems.

任何帮助表示赞赏!

最好的问候
Bernd

Best Regards Bernd

编辑:
我有在构建计算机的d:驱动器中添加了一个简单的批处理脚本,并在完成GetSources任务后运行该脚本。这确实下载了所有资源!!!

edit: I have added a simple batch script to the d: drive of the build computer and run that script after the GetSources task was done. This did download all the sources!!!

这是脚本:

tf vc workspace /new /location:local /permission:Public %BUILD_REPOSITORY_TFVC_WORKSPACE% /collection:http://tfs.net:8080/tfs/DefaultCollection/ /noprompt
tf vc workfold /unmap /workspace:%BUILD_REPOSITORY_TFVC_WORKSPACE% $/ /collection:http://tfs.net:8080/tfs/DefaultCollection/ /noprompt
tf vc workfold /map /workspace:%BUILD_REPOSITORY_TFVC_WORKSPACE% $/TPA/BuildVNext/1.7 D:\b\a1\_w\1\s\TPA\BuildVNext\1.7 /collection:http://tfs.net:8080/tfs/DefaultCollection/ /noprompt
tf vc workfold /map /workspace:%BUILD_REPOSITORY_TFVC_WORKSPACE% $/TPA/DevTools/internal/BuildHelper/1.6 %BUILD_SOURCESDIRECTORY%\TPA\DevTools\internal\BuildHelper\1.6 /collection:http://tfs.net:8080/tfs/DefaultCollection/ /noprompt
tf vc workfold /map /workspace:%BUILD_REPOSITORY_TFVC_WORKSPACE% $/TPA/DevTools/internal/ReferenceManager/1.9 %BUILD_SOURCESDIRECTORY%\TPA\DevTools\internal\ReferenceManager\1.9 /collection:http://tfs.net:8080/tfs/DefaultCollection/ /noprompt
tf vc workfold /map /workspace:%BUILD_REPOSITORY_TFVC_WORKSPACE% $/TPA/DevTools/external/MsBuild/ExtensionPack/4.0.9 %BUILD_SOURCESDIRECTORY%\TPA\DevTools\external\MsBuild\ExtensionPack\4.0.9 /collection:http://tfs.net:8080/tfs/DefaultCollection/ /noprompt
tf vc workfold /map /workspace:%BUILD_REPOSITORY_TFVC_WORKSPACE% $/TPA/LicenseMgr/dev/main %BUILD_SOURCESDIRECTORY%\TPA\LicenseMgr\dev\main /collection:http://tfs.net:8080/tfs/DefaultCollection/ /noprompt
tf vc get /version:%BUILD_SOURCEVERSION% /recursive /overwrite %BUILD_SOURCESDIRECTORY% /noprompt

As我说过,这确实下载了所有源,但查看了错误消息,尤其是工作区的帐户信息:

As I said, this did download all the sources, but have a look at the error messages, especially the account information of the workspace:

D:\b\a1\_w\1\s>tf vc workspace /new /location:local /permission:Public ws_1_12 /collection:http://tfs.net:8080/tfs/DefaultCollection/ /noprompt 
The path D:\b\a1\_w\1\s\TPA\BuildVNext\1.7 is already mapped in workspace ws_1_12;Build\beb2741f-e779-4a6f-a20e-033796fec5b7.

D:\b\a1\_w\1\s>tf vc workfold /unmap /workspace:ws_1_12 $/ /collection:/collection:http://tfs.net:8080/tfs/DefaultCollection//noprompt 
TF14061: The workspace ws_1_12;Build_LicenseMgr does not exist.

D:\b\a1\_w\1\s>tf vc workfold /map /workspace:ws_1_12 $/TPA/BuildVNext/1.7 D:\b\a1\_w\1\s\TPA\BuildVNext\1.7 /collection:/collection:http://tfs.net:8080/tfs/DefaultCollection/ /noprompt 
TF14061: The workspace ws_1_12;Build_LicenseMgr does not exist.

D:\b\a1\_w\1\s>tf vc workfold /map /workspace:ws_1_12 $/TPA/DevTools/internal/BuildHelper/1.6 D:\b\a1\_w\1\s\TPA\DevTools\internal\BuildHelper\1.6 /collection:/collection:http://tfs.net:8080/tfs/DefaultCollection/ /noprompt 
TF14061: The workspace ws_1_12;Build_LicenseMgr does not exist.

D:\b\a1\_w\1\s>tf vc workfold /map /workspace:ws_1_12 $/TPA/DevTools/internal/ReferenceManager/1.9 D:\b\a1\_w\1\s\TPA\DevTools\internal\ReferenceManager\1.9 /collection:/collection:http://tfs.net:8080/tfs/DefaultCollection/ /noprompt 
TF14061: The workspace ws_1_12;Build_LicenseMgr does not exist.

D:\b\a1\_w\1\s>tf vc workfold /map /workspace:ws_1_12 $/TPA/DevTools/external/MsBuild/ExtensionPack/4.0.9 D:\b\a1\_w\1\s\TPA\DevTools\external\MsBuild\ExtensionPack\4.0.9 /collection:/collection:http://tfs.net:8080/tfs/DefaultCollection/ /noprompt 
TF14061: The workspace ws_1_12;Build_LicenseMgr does not exist.

D:\b\a1\_w\1\s>tf vc workfold /map /workspace:ws_1_12 $/TPA/LicenseMgr/dev/main D:\b\a1\_w\1\s\TPA\LicenseMgr\dev\main /collection:/collection:http://tfs.net:8080/tfs/DefaultCollection/ /noprompt 
TF14061: The workspace ws_1_12;Build_LicenseMgr does not exist.

D:\b\a1\_w\1\s>tf vc get /version:178749 /recursive /overwrite D:\b\a1\_w\1\s /noprompt 
D:\b\a1\_w\1\s\TPA\LicenseMgr\dev:
Getting main

edit2:
要使我的构建工作顺利完成,我只需要在批处理脚本中的一行上输入即可即可。

edit2: To make my build work I just need on single line in the batch script:

tf vc get /version:%BUILD_SOURCEVERSION% /recursive /overwrite %BUILD_SOURCESDIRECTORY% /noprompt

因此原始GetSources任务中的/ loginType:OAuth对我造成了问题。

So the /loginType:OAuth in the original GetSources task is causing the problem for me. The same command without the /loginType does work!

推荐答案

最后找到问题的根本原因:
在XAML中构建配置为运行构建服务的帐户,该帐户还用于创建工作区并获取源。
在vNext中构建 Project Collection Build Service,用于创建工作区并获取源。
项目集合构建服务帐户无权访问LicenseManager源代码。

Finally found the root cause of the problem: In XAML builds the account that is configured to run the build service is also used to create the workspace and get the sources. In vNext builds the "Project Collection Build Service" is used to create the workspace and get the sources. The "Project Collection Build Service" account did not have access to the LicenseManager source code.

在授予项目集合构建服务帐户访问权后, LicenseManager源代码,一切都会正常进行:)

After giving the "Project Collection Build Service" account access rights to the LicenseManager source code, everything is working as it should :)

这篇关于TFS vNext Build:GetSources任务无法从访问受限的文件夹中获取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆