Jenkins插件之“Join Plugin”

https://wiki.jenkins.io/display/JENKINS/Join+Plugin

This plugin allows a job to be run after all the immediate downstream jobs have completed. In this way, the execution can branch out and perform many steps in parallel, and then run a final aggregation step just once after all the parallel work is finished.
The plugin is useful for creating a 'diamond' shape project dependency. This means there is a single parent job that starts several downstream jobs. Once those jobs are finished, a single aggregation job runs. More complex interactions are not possible with this plugin.

The downstream projects are specified using Hudson's normal project relationship mechanism.

此插件允许在所有直接下游作业完成后运行一个作业。通过这种方式,执行可以并行地分支并执行许多步骤,然后在所有并行工作完成后,最后运行一次聚合步骤。
这个插件对于创建一个“菱形”依赖项非常有用。这意味着有一个单亲作业启动几个下游作业。一旦这些工作完成,一个聚合作业就会运行。此插件不可能实现更复杂的交互。
下游项目是使用jenkins的正常项目关系机制来指定的。

Jenkins插件之“Join Plugin”
Jenkins插件之“Join Plugin”
Jenkins插件之“Join Plugin”
Jenkins插件之“Join Plugin”

功能:

Thisplugin allows a job to be run after all the immediate downstream jobs havecompleted. In this way, the execution can branch out andperform many steps in parallel, and then run a final aggregation step just onceafter all the parallel work is finished. (Jobs 按照既定的顺序执行)

执行顺序

Test 执行

Test执行完毕

testDown 与testDown2并行执行

testDown执行完毕

testDown2执行完毕

testJoin开始执行

testJoin执行完毕

Jenkins中各job并行后再触发job

在使用jenkins执行自动化脚本,因为用例过多,所以决定并行job执行来提高效率,当然这个在之前的一篇文件介绍就可以做到,先配置一个job_A,然后用job_B触发两个下游job来实现并行。一开始我也是这样设计的,后面出现了问题,因为我需要把并行执行的结果合并,这个合并需要在两个并行job执行后来完成,所以就卡在这里。后来经过google查询,了解到jenkins的另一个插件可以完成这个操作。

1.再次说明下想做的事情

(1)A、B两个job并行执行用例
(2)执行完后合并A、B的结果,生成报告

2.JOIN Plugin

这个插件作用主要是会让整个job的下游job全部完成后再执行。所以场景为A、B、C、D四个job,A的下游为B、C,然后A设置的join trigger为D,这样D会等B、C两个job完成再运行D而达到效果。
A:设置两个下游B、C,设置join trigger为D

Jenkins插件之“Join Plugin”

B:运行部分用例,设置Archive the artifacts把结果文件传递
C:运行部分用例,设置Archive the artifacts把结果文件传递
D:把B、C的结果文件放在workspace中,合并结果集

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章