【发布时间】:2019-09-06 03:44:52
【问题描述】:
我尝试在 TFS 构建定义中编写构建步骤,其中之一是调用位于文件系统中的 SoapUI 的 CMD 运行 bat 脚本:
C:\"Program Files"\SmartBear\SoapUI-5.2.1\bin\testrunner
此 bat 脚本使用存储库中的 *.xml 文件运行测试步骤。
运行此步骤后,TFS 尝试终止发送 SIGBREAK (CTRL_C) 的脚本,然后 CMD 步骤停止并显示消息“终止批处理作业 (Y/N)?”。
问题肯定出在这个 bat 脚本中,因为其他脚本工作正常。 Batch 和 Powershell 也是如此。 我可以在 TFS 中阻止这种行为吗?
附:我发现有趣的是,在文件系统日志中 TFS 写入以下内容:
Stop aggressive process web console line queue.
附言脚本需要访问 Internet 才能向网络服务发送请求。
TFS 日志:
2019-04-15T13:23:30.6310955Z ##[section]Starting: Run Tests
2019-04-15T13:23:30.6314476Z ==============================================================================
2019-04-15T13:23:30.6314575Z Task : Batch Script
2019-04-15T13:23:30.6314677Z Description : Run a windows cmd or bat script and optionally allow it to change the environment
2019-04-15T13:23:30.6314760Z Version : 1.1.3
2019-04-15T13:23:30.6314831Z Author : Microsoft Corporation
2019-04-15T13:23:30.6314926Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613733)
2019-04-15T13:23:30.6315025Z ==============================================================================
2019-04-15T13:23:30.6326914Z ##[command]"C:\Program Files\SmartBear\SoapUI-5.2.1\bin\testrunner.bat" -r -j -ftests %testScript% 2>NUL
2019-04-15T13:23:31.7381481Z 18:23:31,483 INFO [DefaultSoapUICore] Creating new settings at [C:\Windows\ServiceProfiles\NetworkService\soapui-settings.xml]
2019-04-15T13:23:33.0767434Z 18:23:32,679 INFO [PluginManager] 0 plugins loaded in 2 ms
2019-04-15T13:23:33.0767679Z 18:23:32,679 INFO [DefaultSoapUICore] All plugins loaded
2019-04-15T13:24:22.9158044Z Terminate batch job (Y/N)?
2019-04-15T13:24:22.9249350Z ##[error]The operation was canceled.
2019-04-15T13:24:22.9280244Z ##[section]Finishing: Run Tests
我还在文件系统 C:\agent_diag 中发现了以下日志
[2019-04-15 12:13:40Z INFO ProcessInvokerWrapper] Process started with process id 7868, waiting for process exit.
[2019-04-15 12:13:40Z INFO JobServerQueue] Try to append 1 batches web console lines for record '5119da93-a929-543c-7e43-439284c14c5d', success rate: 1/1.
[2019-04-15 12:13:40Z INFO JobServerQueue] Try to append 1 batches web console lines for record 'b544018b-4d71-5134-742f-cb63728506de', success rate: 1/1.
[2019-04-15 12:13:40Z INFO JobServerQueue] Try to append 1 batches web console lines for record '85f1bd98-2921-5766-8330-d8b491fc5b96', success rate: 1/1.
[2019-04-15 12:13:43Z INFO JobServerQueue] Try to append 1 batches web console lines for record '85f1bd98-2921-5766-8330-d8b491fc5b96', success rate: 1/1.
[2019-04-15 12:13:43Z INFO JobServerQueue] Try to upload 2 log files or attachments, success rate: 2/2.
[2019-04-15 12:13:44Z INFO JobServerQueue] Try to append 1 batches web console lines for record '85f1bd98-2921-5766-8330-d8b491fc5b96', success rate: 1/1.
[2019-04-15 12:13:51Z INFO JobServerQueue] Stop aggressive process web console line queue.
[2019-04-15 12:18:29Z INFO Worker] Cancellation/Shutdown message received.
[2019-04-15 12:18:29Z INFO ExpressionManager] Evaluating: succeeded()
[2019-04-15 12:18:29Z INFO ExpressionManager] Result: False
[2019-04-15 12:18:29Z INFO StepsRunner] Cancel current running step.
[2019-04-15 12:18:29Z INFO ProcessInvokerWrapper] Sending CTRL_C to process 7868.
[2019-04-15 12:18:29Z INFO ProcessInvokerWrapper] Successfully send CTRL_C to process 7868.
[2019-04-15 12:18:29Z INFO ProcessInvokerWrapper] Waiting for process exit or 7.5 seconds after CTRL_C signal fired.
[2019-04-15 12:18:29Z INFO ProcessInvokerWrapper] Ignore Ctrl+C to current process.
[2019-04-15 12:18:29Z INFO ProcessInvokerWrapper] Finished process with exit code 1, and elapsed time 00:04:49.0108550.
[2019-04-15 12:18:29Z ERR StepsRunner] Caught cancellation exception from step: System.OperationCanceledException: The operation was canceled.
at System.Threading.CancellationToken.ThrowOperationCanceledException()
at Microsoft.VisualStudio.Services.Agent.Util.ProcessInvoker.<ExecuteAsync>d__26.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.ProcessInvokerWrapper.<ExecuteAsync>d__12.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.Handlers.PowerShellExeHandler.<RunAsync>d__13.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.TaskRunner.<RunAsync>d__24.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()
[2019-04-15 12:18:29Z INFO StepsRunner] Step result: Canceled
[2019-04-15 12:18:29Z INFO StepsRunner] No need for updating job result with current step result 'Canceled'.
[2019-04-15 12:18:29Z INFO StepsRunner] Current state: job state = 'Canceled'
[2019-04-15 12:18:29Z INFO StepsRunner] Processing step: DisplayName='Post Job Cleanup', ContinueOnError=False, Enabled=True
[2019-04-15 12:18:29Z INFO ExpressionManager] Evaluating: AlwaysNode()
[2019-04-15 12:18:29Z INFO ExpressionManager] Result: True`
【问题讨论】:
-
测试完成后终止?如果你应该能够按“y”就可以了吗?或者您的问题是任务终止的原因?
-
@ShaykiAbramczyk 我不确定测试是否完成,因为我无法获得有关任务状态的任何信息。主要问题是我也无法按下任何东西,因为 TFS 运行此脚本并且脚本等待 TFS 按下。所以情况看起来像“死锁”,TFS 正在等待脚本完成,而脚本等待 TFS 按下任何东西。
-
可以分享一下批处理文件吗?
-
@ShaykiAbramczyk 是的,请:link。注意:那不是我的代码。它带有 SoapUI 安装。
标签: tfs continuous-integration pipeline devops