如何在多个并发上游作业成功后启动Jenkins作业? [英] How do I make a Jenkins job start after multiple simultaneous upstream jobs succeed?

查看:972
本文介绍了如何在多个并发上游作业成功后启动Jenkins作业?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了获得最快的反馈,我们偶尔希望Jenkins作业以并行方式运行。 Jenkins有能力在作业完成时启动多个下游作业(或fork管道)。然而,Jenkins似乎没有任何办法做下游工作,只有开始的所有分支的叉子成功(或加入叉子在一起)。

In order to get the fastest feedback possible, we occasionally want Jenkins jobs to run in Parallel. Jenkins has the ability to start multiple downstream jobs (or 'fork' the pipeline) when a job finishes. However, Jenkins doesn't seem to have any way of making a downstream job only start of all branches of that fork succeed (or 'joining' the fork back together).

Jenkins有一个Build after other projects are built按钮,但我将其解释为任何上游作业完成时启动此作业(不是全部< >上游作业成功)。

Jenkins has a "Build after other projects are built" button, but I interpret that as "start this job when any upstream job finishes" (not "start this job when all upstream jobs succeed").

这里是我所说的一个可视化。有人知道如果插件存在做我所做的事吗?

Here is a visualization of what I'm talking about. Does anyone know if a plugin exists to do what I'm after?

当我最初在2012年发布这个问题,Jason的回答(加入和推荐Build插件)是最好的,解决方案我去了。

When I originally posted this question in 2012, Jason's answer (the Join and Promoted Build plugins) was the best, and the solution I went with.

但是,dnozay的答案(构建流插件)在这个问题后大约一年左右,这是一个更好的答案。

However, dnozay's answer (The Build Flow plugin) was made popular a year or so after this question, which is a much better answer. For what it's worth, if people ask me this question today, I now recommend that instead.

推荐答案

有两个解决方案,我过去曾使用过这种情况:

There are two solutions that I have used for this scenario in the past:


  1. 使用加入插件,并指定提升作为目标作业。您必须将功能测试和性能测试指定为已连接的作业,并以某种方式(后构建)启动它们。 参数化触发器插件适用于此。

  1. Use the Join Plugin on your "deploy" job and specify "promote" as the targeted job. You would have to specify "Functional Tests" and "Performance Tests" as the joined jobs and start them via in some fashion, post build. The Parameterized Trigger Plugin is good for this.

对您的部署使用推荐内容插件 作业,指定在下游作业完成时可用的推广,并指定功能和性能测试作业。作为促销行动的一部分,触发促销工作。您仍然必须从deploy启动两个测试作业

Use the Promoted Builds Plugin on your "deploy" job, specify a promotion that works when downstream jobs are completed and specify Functional and Performance test jobs. As part of the promotion action, trigger the "promote" job. You still have to start the two test jobs from "deploy"

这两个解决方案都有CRITICAL方面:指纹必须正确使用。这是我发现的:

There is a CRITICAL aspect to both of these solutions: fingerprints must be correctly used. Here is what I found:


  1. build作业必须ORIGINATE一个新的指纹文件。换句话说,它必须指纹一些Jenkins认为是由最初的工作发起的文件。仔细检查作业的查看指纹链接以验证此操作。

  2. 所有下游链接作业(在本例中为部署,功能测试和性能测试)需要获取并指纹此同一文件。

  3. 请记住,一些插件允许您更改指纹和下游作业启动的顺序;在这种情况下,指纹必须在下游作业指纹相同的文件之前发生,以确保指纹的ORIGIN设置正确。

这篇关于如何在多个并发上游作业成功后启动Jenkins作业?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆