詹金斯:如果最后一步成功,即使前一步不稳定,也将构建标记为成功

Jenkins: Mark build as success if the last step succeded even if a previous step was unstable

我在詹金斯的流程是这样的:

包装作业 1

下面是JOB1(wrapper)配置图片:

JOB2触发器配置:

JOB3 条件触发配置

现在,给你一点背景信息:

我正在 运行 使用 selenium 和 cucumber 进行测试,这些测试可能会随机失败,如果失败,job2 将被标记为不稳定(如果不是包装器,则以成功状态完成),以防 job2失败将触发 job3,这是一个 "RERUN FAILED TESTS" 任务,显然在最后一个将成功完成的情况下,我希望包装器被标记为成功。

这应该很简单,但它不起作用,在包装器 (JOB1) jenkins 作业日志下面:

第一步(作业 2)不稳定,因为某些测试失败:

Waiting for the completion of REM_Parallel_Tag_Sub_Runner
REM_Parallel_Tag_Sub_Runner #9 completed. Result was UNSTABLE
Build step 'Trigger/call builds on other projects' changed build result    
to **UNSTABLE**

如果作业 2 不稳定,包装程序会触发作业 3:

[Current build status] check if current [UNSTABLE] is worse or equals then
[UNSTABLE] and better or equals then [UNSTABLE]
Run condition [Current build status] enabling perform for step [BuilderChain]
Waiting for the completion of REM_Parallel_Sub_ReRuns

作业 3 成功,这意味着之前失败的测试现在成功了,我希望此步骤将作业 1 从不稳定更新为成功,这应该是一种正常行为

 REM_Parallel_Sub_ReRuns #6 completed. Result was SUCCESS
 [CucumberReportPublisher] Compiling Cucumber Html Reports ...
 [CucumberReportPublisher] Copying all json files from: /PATH/workspace  /TiaCukes to reports directory: /PATH/cucumber-html-reports
 [CucumberReportPublisher] there were no json results found in: /u01/app/build/jenkins/jobs/REM_Parallel_Tag_Runner_Orchestrator/builds/9/cucumber-html-reports
 Started calculate disk usage of build
 Finished Calculation of disk usage of build in 0 seconds
 Started calculate disk usage of workspace
 Finished Calculation of disk usage of workspace in 0 seconds
 No emails were triggered.
 Warning: you have no plugins providing access control for builds, so    falling back to legacy behavior of permitting any downstream builds to be triggered

 Finished: UNSTABLE

如您所见,构建状态尚未更新,即使最后触发的步骤成功,构建状态仍然不稳定

我该如何解决?不应该是这么难完成的目标!

非常感谢!

使用参数化触发器插件设置的变量解决:

https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin

下图:

JOB2 触发器配置:

JOB3条件触发配置:

欢迎询问详情