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中,合併結果集

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