我尝试在TFS构建定义中编写构建步骤,其中一个是调用运行位于文件系统中的SoapUI的bat脚本的CMD:
C:“程序文件”SmartBear ZapUI-5.2.1是一名跑步者
此bat脚本在存储库中运行* .xml文件的测试步骤。
在此步骤运行后,TFS尝试终止发送SIGBREAK(CTRL_C)的脚本,然后CMD步骤停止并显示消息“终止批处理作业(是/否)?”。
问题肯定出在这个bat脚本中,因为其他脚本运行正常。 Batch和Powershell也是如此。我可以在TFS中阻止此行为吗?
附:我觉得有趣的是,在文件系统日志中,TFS写入以下内容:Stop aggressive process web console line queue.
P.S.S.脚本需要Internet访问才能将请求发送到Web服务。
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`