首页 > 解决方案 > Azure Pipeline 中的 Webdriver-Manager 更新

问题描述

之前在 Azure Pipelines 中遇到过问题webdriver-manager update,我想添加此命令的附加副本以在第一个失败时运行。 在此处输入图像描述 这很好用——虽然我仍然希望webdriver-manager update总是第一次工作!

但是,如果需要第二个命令,即使实际运行的测试通过,测试也会显示为失败。 在此处输入图像描述

如果不需要第二个命令(它被标记为“已跳过”),那么一切都很好并且如果实际测试通过,我会得到正确的结果。

所以我的查询是,是否可以“忽略”失败的第一次更新并将管道显示为通过(当然前提是测试通过)!

我附上了两个更新命令设置的快照: 在此处输入图像描述在此处输入图像描述

谢谢你。

为了完整起见,以下是更新失败时的错误:

2019-09-19T10:44:50.9881873Z ##[section]Starting: Webdriver-Manager Update
2019-09-19T10:44:51.0064449Z 

2019-09-19T10:44:51.0064522Z Task         : Command Line
2019-09-19T10:44:51.0064560Z Description  : Run a command line with 
arguments
2019-09-19T10:44:51.0064612Z Version      : 1.1.3
2019-09-19T10:44:51.0064666Z Author       : Microsoft Corporation
2019-09-19T10:44:51.0064703Z Help         : [More Information] 
(https://go.microsoft.com/fwlink/?LinkID=613735)
2019-09-19T10:44:51.0064738Z 



2019-09-19T10:44:51.0162388Z ##[command]node 
node_modules/protractor/bin/webdriver-manager update
2019-09-19T10:44:51.7954075Z [11:44:51] I/config_source - curl - 
oC:\vsts\vsts-agent-win-x64-2.140.0\_work\64\s\node_modules\webdriver- 
manager\selenium\standalone-response.xml https://selenium- 
release.storage.googleapis.com/
2019-09-19T10:44:51.8085038Z [11:44:51] I/config_source - curl - 
oC:\vsts\vsts-agent-win-x64-2.140.0\_work\64\s\node_modules\webdriver- 
manager\selenium\chrome-response.xml 
https://chromedriver.storage.googleapis.com/
2019-09-19T10:44:51.8148392Z [11:44:51] I/config_source - curl - 
oC:\vsts\vsts-agent-win-x64-2.140.0\_work\64\s\node_modules\webdriver- 
manager\selenium\gecko-response.json 
https://api.github.com/repos/mozilla/geckodriver/releases
2019-09-19T10:44:52.4275157Z events.js:183
2019-09-19T10:44:52.4276258Z       throw er; // Unhandled 'error' event
2019-09-19T10:44:52.4279198Z       ^
2019-09-19T10:44:52.4280058Z 
2019-09-19T10:44:52.4280232Z Error: read ECONNRESET
2019-09-19T10:44:52.4280279Z     at TLSWrap.onread (net.js:622:25)
2019-09-19T10:44:52.4632661Z ##[error]Process completed with exit code 1.
2019-09-19T10:44:52.4649070Z ##[section]Finishing: Webdriver-Manager 
Update

标签: azure-pipelines

解决方案


如果您的构建管道中有失败的任务,构建管道将显示失败状态。它按设计工作。如果您选中 Continue on error 条件,当您的第一个任务失败时,构建管道将显示部分成功。 在此处输入图像描述

如果你想要这个状态,那么你的运行逻辑应该改变。你应该先设置一个管道变量,像这样 在此处输入图像描述

在您的第一个任务中,您应该在更新命令之后将变量值更新为 false。并像这样设置第二个任务运行条件。 在此处输入图像描述

这意味着,如果您的第一个任务失败,变量值不会改变,并且该值符合第二个任务的自定义条件,因此第二个任务将运行。如果您的第一个任务成功,变量值将更改,然后第二个任务将不会运行。


推荐阅读