1

我们目前正在从 XAML 构建迁移到 vNext (TFS2017)。“正常”构建工作正常,但我们的 LicenseManager 构建不起作用。包含 LicenseManager 源代码的文件夹只能由特定用户访问。因此,我配置了一个 vNext 构建代理,其中构建服务在可以访问源代码的帐户上运行(就像我们对 xaml 构建所做的那样)。我使用 Capabilities and Demands 来强制在该代理上构建 LicenseManager。

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

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 时,选择在构建期间创建的工作区,然后选择“获取最新”,它确实会下载代码而没有任何问题。

任何帮助表示赞赏!

最好的问候伯恩德

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

这是脚本:

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

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

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:为了使我的构建工作,我只需要在批处理脚本中的单行:

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

因此,原始 GetSources 任务中的 /loginType:OAuth 对我造成了问题。没有 /loginType 的相同命令确实有效!

4

2 回答 2

1

Seems the issue is still related to the permission. Suggest you double check the related account permission, also give it local admin permission on the build agent.

You could also disable the default get source steps in the build definition. And use your own script to do the get source/pull files to see if you get the same situation. How to, please follow: Is it able to ignore/disable the first step Get source in vNext Build?

Write a powershell script to do the entire get source option and use the account which have enough permission to pull down the limited LicenseManager folder.

于 2018-01-26T11:30:26.577 回答
0

终于找到了问题的根本原因:在 XAML 构建中,配置为运行构建服务的帐户也用于创建工作区并获取源。在 vNext 构建中,“项目集合构建服务”用于创建工作区并获取源。“项目集合构建服务”帐户无权访问 LicenseManager 源代码。

在授予“项目集合构建服务”帐户对 LicenseManager 源代码的访问权限后,一切正常:)

于 2018-01-30T15:11:16.890 回答