azure - 我在 Azure 管道步骤中收到 "Bash wrote one or more lines to the standard error stream"

标签 azure azure-devops pipeline azure-pipelines

我正在运行以下-bash命令:

    bash: $(ci_scripts_path)/01_install_python_tools.sh displayName: '安装 python 2.7 工具' failOnStderr:true

虽然 sh 脚本 01_install_python_tools.sh 成功完成,但无论如何我在该步骤中收到此错误: ##[error]Bash 将一行或多行写入标准错误流。

最佳答案

我今天刚刚处理这个问题,并通过取消选中 Bash 任务的高级选项中的“标准错误失败”来解决它。如果您的脚本返回非零退出代码,该步骤仍然会失败,但如果您返回 0,该步骤将会成功。

所以,如果我想返回成功,我有脚本exit 0 如果我想抛出错误,我会执行exit 1。例如,我有一个执行以下操作的脚本:

if [ "$someResult" == "yay it worked" ] then
    echo "Success!"
    exit 0
else
    echo "Failsauce!"
    exit 1
fi

我想了很长一段时间,我必须启用该选项才能将失败返回到管道中,但显然情况并非如此。

关于azure - 我在 Azure 管道步骤中收到 "Bash wrote one or more lines to the standard error stream",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54697104/

相关文章:

c# - 辅助角色 localstorage 的目录未找到异常

tfsbuild - VSO/VSTS : Error when using Publish Build Artifacts on the host agent

powershell - Powershell流水线数据到外部控制台应用程序

azure-devops - 如何将 Mark Down 样式添加到 Azure DevOps 网站

ruby-on-rails - 在 Assets 管道中需要树

assembly - 管道危险

azure - Azure 流量管理器可以与 API 管理一起使用吗?

azure - 如何将文件从存储帐户容器中的一个文件夹移动到另一文件夹

azure - Windows Azure AppFabric 服务是否已停止?

asp.net-core - Xunit 无法使用 Visual Studio Team Services Build VNext 工作