简体   繁体   English

如何仅成功执行两个上游作业来触发jenkins下游作业

[英]how to trigger jenkins downstream job only both upstreams jobs successfully executed

I have created Job A which looks for upstream jobs (Job B and Job C) success result and triggers a shell script to verify a condition. 我创建了作业A ,该作业寻找上游作业(作业B和作业C)成功的结果,并触发Shell脚本来验证条件。

Once Job B and Job C executed successfully Job A executes downstream jobs (Job D and Job E) . 一旦作业B作业C成功执行, 作业A将执行下游作业(作业D和作业E)

I have used reverse (to configure upstream jobs) and downstream-ext (to configure downstream jobs) plugins in Job A using JJB. 我已经在作业A中使用JJB使用了reverse (用于配置上游作业)和downstream-ext (用于配置下游作业)插件。

Issue I am facing here is: After Job B is executed successfully without waiting for Job C result. 我在这里面临的问题是:作业B成功执行后,没有等待作业C结果。 Job A should wait for both Job B and Job C and then execute based on the result. 作业A应同时等待作业B和作业C,然后根据结果执行。

Could you please help me how to configure this scenario. 您能否帮助我如何配置此方案。

You can try using the Join Plugin, here is the documentation: 您可以尝试使用Join插件,这里是文档:
https://wiki.jenkins-ci.org/display/JENKINS/Join+Plugin https://wiki.jenkins-ci.org/display/JENKINS/Join+Plugin

This'd be easier if you convert your A job to a build flow https://wiki.jenkins.io/display/JENKINS/Build+Flow+Plugin?focusedCommentId=60917290 or even better it's successor Pipeline 2.0 https://jenkins.io/doc/book/pipeline/ 如果您将A作业转换为构建流程,这会更容易https://wiki.jenkins.io/display/JENKINS/Build+Flow+Plugin?focusedCommentId=60917290甚至更好,它是Pipeline 2.0的后继者https:// jenkins .io / doc / book / pipeline /

(Groovy) Code in A would then be something like: (Groovy)A中的代码将类似于:

if (build('scenario-B-Job') && build('scenario-C-Job')) {
    build('scenario-E-Job')
    build('scenario-D-Job')

} You can also parallelize (B,C and then D,E) to shorten overall execution times if you have enough slaves around. }如果周围有足够多的从属服务器,则还可以并行化(B,C,然后是D,E)以缩短总体执行时间。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 詹金斯 - 在所有下游工作完成后触发工作,而不仅仅是直接工作 - Jenkins - trigger job after all downstream jobs have completed, not only the immediate ones 詹金斯:触发下游工作 - Jenkins: trigger a downstream job 如果詹金斯满足条件,如何触发下游作业 - How to trigger a downstream job if a condition is met in Jenkins 如何延迟触发 Jenkins 下游构建作业? - How to trigger Jenkins downstream build job with a delay? 如果下游作业失败,如何使主詹金斯管道作业失败 - How to fail master Jenkins pipeline job if downstream jobs fails 无论上游作业状态如何,如何触发 jenkins 下游作业 - how to trigger jenkins downstream job irrespective upstream job status 如何在詹金斯中将参数作为环境变量从上游作业传递到下游作业? 无需对下游工作进行参数化 - How to pass parameter as environment variable from upstream job to downstream job in jenkins? without downstream jobs being parametrized 如何将工件从下游作业复制到 Jenkins 中的顶级作业 - How to copy artifacts from downstream jobs to top level job in Jenkins 如何阻止父作业,直到两个下游作业都完成 - How to block parent job until both the downstream jobs are completed 如何在Jenkins中并行运行3个作业,然后在所有3个作业成功完成后立即和if和立即触发第四个作业 - How to run 3 jobs in Jenkins in parallel then trigger fourth job if and IMMEDIATELY when all 3 complete successfully
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM