在多个同时上游作业成功后,如何让 Jenkins 作业开始? [英] How do I make a Jenkins job start after multiple simultaneous upstream jobs succeed?

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

问题描述

为了尽可能获得最快的反馈,我们有时希望 Jenkins 作业并行运行.Jenkins 能够在作业完成时启动多个下游作业(或分叉"管道).但是,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 有一个在构建其他项目后构建"按钮,但我将其解释为在 any 上游作业完成时开始这项工作"(而不是在 all<时开始这项工作"/strong> 上游作业成功").

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 的回答(加入和升级的构建插件)是最好的,也是我采用的解决方案.

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. 在您的部署"作业中使用 加入插件 并指定促进作为目标工作.您必须将功能测试"和性能测试"指定为加入的作业,并以某种方式启动它们,后期构建.Parameterized Trigger Plugin 非常适合.

  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.

在您的部署"工作中使用Promoted Builds Plugin,指定在下游作业完成时有效的促销活动,并指定功能和性能测试作业.作为提升操作的一部分,触发提升"作业.您仍然必须从部署"开始这两个测试作业

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"

这两种解决方案都有一个关键方面:必须正确使用指纹.这是我发现的:

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

  1. 构建"作业必须创建一个新的指纹文件.换句话说,它必须对 Jenkins 认为源自初始工作的文件进行指纹识别.仔细检查作业的查看指纹"链接以验证这一点.
  2. 所有下游链接的作业(在本例中为部署"、功能测试"和性能测试")都需要获取同一个文件并对其进行指纹识别.Copy Artifacts 插件非常适合这类事情.
  3. 请注意,某些插件允许您更改指纹识别和下游作业开始的顺序;在这种情况下,必须在下游作业对同一文件进行指纹识别之前进行指纹识别,以确保正确设置指纹的 ORIGIN.

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

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