在参数化触发器插件中,"Fail this build step" 和 "Mark this build as failure" 有什么区别?
In Parametrized Trigger Plugin, what's the difference between "Fail this build step" and "Mark this build as failure"?
我正在检查使用参数化触发器插件调用其他项目的作业。我试图理解两个选项:如果触发的构建更差或等于,则此构建步骤失败;如果触发的构建,将此构建标记为失败更差或等于。有可用的文档,但我也不明白。
- Fail this build step if the triggered build is worse or equal to: This option takes precedence over the two following ones if its value
is not never. In that case, the result of the current build step (that
is, success or failure) is based on the result of the triggered
builds. If the condition defined for at least one of the triggered
build is met, then the build step will be considered as failed.
- Mark this build as failure if the triggered build is worse or equal to: This option takes precedence over the next one if its value is not
set to never. In that case, the current build will be considered as
failed based on the result of the triggered builds and the value of
the option.
*文档中暗示的第三个选项是“如果触发的构建更差或等于,则将此构建标记为不稳定”,我想它的工作原理与第二个选项相同
此处“构建步骤失败”和“构建失败”之间的实际区别是什么?第一个是否意味着步骤 'fails' 和构建是 'failed' 但构建继续执行?第二个将构建设置为 'failed' 然后停止? 'unstable' 版本会发生什么,据我了解 'unstable' 状态通常不会停止构建?
这两个选项之间的区别确实是在触发构建失败的情况下失败类型的行为。这两个选项允许在构建步骤失败时更改默认行为。我将尝试根据插件的 perform
方法的 Source Code 来解释行为。
每个构建器插件(将作为构建步骤公开)都有一个 perform
方法,该方法将在执行插件的构建步骤时调用。要发出失败信号,此方法可以抛出异常或 return false
- 这将通知执行者该步骤已失败,因此它将停止执行任何进一步的构建步骤并将构建结果标记为 失败。但是,perform
函数也可以直接设置构建结果,并且 return true
- 从而在没有失败的情况下通知执行者,同时仍然将构建结果设置为所需的值。
现在让我们检查这个插件的情况 a(当您将选项配置为 FAILURE):
- 当您选择 如果触发的构建是,则此构建步骤失败
更糟或等于 它将导致
perform
方法 return
false
,从而通知执行者步骤失败,所以
执行将停止,进一步的构建步骤将不会执行并且构建结果将被标记为FAILURE .
在控制台输出中,您将看到如下内容:
Build step 'Trigger/call builds on other projects' marked build as failure
- 当您选择如果触发的构建更差或等于将此构建标记为失败时,它将导致
perform
方法使用[=设置构建结果18=] 但 returned 值将是 true
,所以
执行不会停止,将执行进一步的构建步骤,但构建结果将被标记为FAILURE .
在控制台输出中,您将看到如下内容:
Build step 'Trigger/call builds on other projects' changed build result to FAILURE
关于 'unstable' 版本,与第二个选项一样,它们都是“标记此构建” - 意味着它们只是设置构建结果并且不影响执行。在 'UNSTABLE' 结果的情况下,这是默认且唯一的行为,因为它永远不会停止执行,因此 'UNSTABLE' 结果具有第一个选项没有任何意义。
TL;DR两个选项的区别:
如果触发的构建更差或等于,则此构建步骤失败:将使当前运行构建步骤失败,停止所有进一步的构建步骤执行并将构建结果标记为失败.
Mark this build as failure if the triggered build worse or equal to : 将构建结果标记为FAILURE,并继续执行所有后续构建步骤。
我正在检查使用参数化触发器插件调用其他项目的作业。我试图理解两个选项:如果触发的构建更差或等于,则此构建步骤失败;如果触发的构建,将此构建标记为失败更差或等于。有可用的文档,但我也不明白。
- Fail this build step if the triggered build is worse or equal to: This option takes precedence over the two following ones if its value is not never. In that case, the result of the current build step (that is, success or failure) is based on the result of the triggered builds. If the condition defined for at least one of the triggered build is met, then the build step will be considered as failed.
- Mark this build as failure if the triggered build is worse or equal to: This option takes precedence over the next one if its value is not set to never. In that case, the current build will be considered as failed based on the result of the triggered builds and the value of the option.
*文档中暗示的第三个选项是“如果触发的构建更差或等于,则将此构建标记为不稳定”,我想它的工作原理与第二个选项相同
此处“构建步骤失败”和“构建失败”之间的实际区别是什么?第一个是否意味着步骤 'fails' 和构建是 'failed' 但构建继续执行?第二个将构建设置为 'failed' 然后停止? 'unstable' 版本会发生什么,据我了解 'unstable' 状态通常不会停止构建?
这两个选项之间的区别确实是在触发构建失败的情况下失败类型的行为。这两个选项允许在构建步骤失败时更改默认行为。我将尝试根据插件的 perform
方法的 Source Code 来解释行为。
每个构建器插件(将作为构建步骤公开)都有一个 perform
方法,该方法将在执行插件的构建步骤时调用。要发出失败信号,此方法可以抛出异常或 return false
- 这将通知执行者该步骤已失败,因此它将停止执行任何进一步的构建步骤并将构建结果标记为 失败。但是,perform
函数也可以直接设置构建结果,并且 return true
- 从而在没有失败的情况下通知执行者,同时仍然将构建结果设置为所需的值。
现在让我们检查这个插件的情况 a(当您将选项配置为 FAILURE):
- 当您选择 如果触发的构建是,则此构建步骤失败
更糟或等于 它将导致
perform
方法 returnfalse
,从而通知执行者步骤失败,所以 执行将停止,进一步的构建步骤将不会执行并且构建结果将被标记为FAILURE .
在控制台输出中,您将看到如下内容:
Build step 'Trigger/call builds on other projects' marked build as failure
- 当您选择如果触发的构建更差或等于将此构建标记为失败时,它将导致
perform
方法使用[=设置构建结果18=] 但 returned 值将是true
,所以 执行不会停止,将执行进一步的构建步骤,但构建结果将被标记为FAILURE .
在控制台输出中,您将看到如下内容:
Build step 'Trigger/call builds on other projects' changed build result to FAILURE
关于 'unstable' 版本,与第二个选项一样,它们都是“标记此构建” - 意味着它们只是设置构建结果并且不影响执行。在 'UNSTABLE' 结果的情况下,这是默认且唯一的行为,因为它永远不会停止执行,因此 'UNSTABLE' 结果具有第一个选项没有任何意义。
TL;DR两个选项的区别:
如果触发的构建更差或等于,则此构建步骤失败:将使当前运行构建步骤失败,停止所有进一步的构建步骤执行并将构建结果标记为失败.
Mark this build as failure if the triggered build worse or equal to : 将构建结果标记为FAILURE,并继续执行所有后续构建步骤。