由于之前在Azure Pipeline中遇到了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发布于 2019-09-23 17:19:40
如果生成管道中存在失败的任务,则生成管道将显示失败状态。它像设计的那样工作。如果选中Continue on error条件,则当第一个任务失败时,构建管道将显示为部分成功。

如果你想要这个状态,那么你的运行逻辑应该被改变。您应该首先设置一个管道变量,如下所示

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

这意味着,如果第一个任务失败,变量值将不会更改,并且该值与第二个任务的自定义条件匹配,因此第二个任务将运行。如果第一个任务成功,则变量值将更改,然后第二个任务将不会运行。
https://stackoverflow.com/questions/58006220
复制相似问题