在TFS 2018中的获取源步骤期间,由于超时而导致构建失败

时间:2018-04-12 19:29:13

标签: git tfs

我们的TFS构建代理在Get Sources步骤中看似随机出现问题,git fetch命令挂起并在一小时后超时。

日志的最后一部分显示它已获得所需的一切但决定停止直到它超时。

2018-04-12T10:00:11.9145204Z Resolving deltas:  97% (123/126)   
2018-04-12T10:00:11.9145204Z Resolving deltas:  99% (125/126)   
2018-04-12T10:00:11.9145204Z Resolving deltas: 100% (126/126)   
2018-04-12T10:00:11.9145204Z Resolving deltas: 100% (126/126), completed with 17 local objects.
2018-04-12T11:00:03.8383793Z ##[debug]Re-evaluate condition on job cancellation for step: 'Get Sources'.
2018-04-12T11:00:04.1196536Z ##[error]The operation was canceled.
2018-04-12T11:00:04.1352781Z ##[debug]System.OperationCanceledException: The operation was canceled.
   at System.Threading.CancellationToken.ThrowOperationCanceledException()
   at Microsoft.VisualStudio.Services.Agent.ProcessInvoker.<ExecuteAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Services.Agent.Worker.Build.GitCommandManager.<ExecuteGitCommandAsync>d__33.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Services.Agent.Worker.Build.GitCommandManager.<GitFetch>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Services.Agent.Worker.Build.GitSourceProvider.<GetSourceAsync>d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Services.Agent.Worker.Build.BuildJobExtension.<GetSourceAsync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   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__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.<RunStepAsync>d__1.MoveNext()
2018-04-12T11:00:04.1352781Z ##[section]Finishing: Get Sources

我们有4个构建代理程序设置,通常一两个在构建期间每晚都有这个问题。

当我查看代理程序目录并运行git status命令时,我收到一条消息:

Rename from 'C:\BuildAgent1\_work\1\s\.git\index.lock' to C:\BuildAgent1\_work\1\s\.git\index' failed. Should I try again? (y/n)

输入&#39; y&#39;只是导致该消息重复。查看.git /文件夹,不存在index.lock文件。

手动发布另一个构建版本,构建过程中没有问题。

为什么在获取所有内容后,构建会挂起?

1 个答案:

答案 0 :(得分:1)

因此,此问题的解决方案是清理sources目录。

  • 清洁设置为true清洁选项选择获取来源步骤下的Sources directory
  • 或者,您可以在代理上手动删除源文件夹 机。 (例如:C:\Agent\_work\2\s\,基本上删除了.git 文件夹将解决问题C:\Agent\_work\2\s\.git

enter image description here

相关问题