gpt4 book ai didi

tfs - 如何清理多个构建代理上的源代码

转载 作者:行者123 更新时间:2023-12-02 03:05:52 25 4
gpt4 key购买 nike

假设您配置了多个构建代理,并且构建代理上有一个文件夹,其中包含一些不是来自 TFS 的内容(即使指定输出,也可能会在项目中生成一些中间内容,例如 obj 文件夹例如文件夹)并且您删除了 TFS 中的文件夹。

下次构建时,您会收到 cannot be deleted because it is not empty. 错误。触发构建时,您可以将 Build.Clean 变量作为 allsource 添加到下一个构建中以修复它。但是,由于您有多个代理,因此只有下一个运行的代理会收到该命令并进行清理,而您创建的落在另一个代理上的任何其他构建都将再次失败,因为它们仍然拥有该文件夹。

编辑整个构建定义,以便他们对每个构建进行完全清理会有点矫枉过正。

我当然在寻找“进入实际文件夹并手动删除文件夹”以外的东西。如果它发生任何变化,则不会托管代理,而是在本地。

编辑:来自构建服务器的日志,从最后一个 cannot be deleted 警告开始:

2017-03-14T20:23:24.2384009Z d:\vso\b1\_work\32\s\[Obfuscated] cannot be deleted because it is not empty.
2017-03-14T20:23:24.4964210Z ##[error]Exit code 1 returned from process: file name 'tf', arguments 'vc get /version:24617 /recursive /overwrite d:\vso\b1\_work\32\s /loginType:OAuth /login:.,******** /noprompt'.
2017-03-14T20:23:24.5124180Z ##[debug]Microsoft.VisualStudio.Services.Agent.ProcessExitCodeException: Exit code 1 returned from process: file name 'tf', arguments 'vc get /version:24617 /recursive /overwrite d:\vso\b1\_work\32\s /loginType:OAuth /login:.,******** /noprompt'.
at Microsoft.VisualStudio.Services.Agent.ProcessInvoker.<ExecuteAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Services.Agent.Worker.Build.TfsVCCommandManager.<RunCommandAsync>d__26.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Services.Agent.Worker.Build.TFCommandManager.<GetAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Services.Agent.Worker.Build.TfsVCSourceProvider.<GetSourceAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Services.Agent.Worker.Build.BuildJobExtension.<PrepareAsync>d__23.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Services.Agent.Worker.JobExtensionRunner.<RunAsync>d__30.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.<RunAsync>d__0.MoveNext()
2017-03-14T20:23:24.5174212Z ##[section]Finishing: Get Sources

最佳答案

通过谷歌遇到这个话题。我们有相同的场景,我试图解释它 here也是。

基本上,我们现在修复它的方法是创建一个新的构建定义,我们使用该定义通过 Build.Clean = all 参数对新构建进行排队。

因此,我们有一个 PowerShell 脚本,它循环遍历我们要清理的所有 AgentsNames,并将新的清理构建排队,并添加需求“Agent.Name -equals agentName”。这样,您的干净构建就会在您要清理的所有代理上排队。

关于tfs - 如何清理多个构建代理上的源代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42860352/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com