在 Octopus 部署中,如果之前的任何步骤失败,我如何 运行 处理步骤

On Octopus deploy, how do I run process step if any of previous steps has failed

我有一个步骤会在部署成功时向 Microsoft Teams 发送消息,我想添加另一个步骤,如果部署出错并且其中一个步骤失败时会发送消息。

我尝试将条件设置为 Variable: only run when the variable expression is true,表达式为 #{if Octopus.Deployment.Error != 0}#{/if}

我的印象是,如果步骤失败,系统变量 Octopus.Deployment.Error 将不同于 0

我使用的 Octopus Deploy 版本是 3.11.11

#{if} 语法不支持条件逻辑。变量将被评估,如果它评估为真值,则 #{if}#{/if} 内的值将用于条件。

您可以将此表达式 #{Octopus.Deployment.Error} 用于 运行 条件。如果设置了错误,它将评估为真,并且该步骤将 运行。如果没有错误,它将评估为 false,并且该步骤不会 运行.

希望对您有所帮助!