本文介绍了如何仅执行詹金斯中最新的排队作业?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Jenkins中有一个提交构建项目,该项目计划在完成时安排一个接受构建项目.由于提交的速度快于接受构建作业的完成时间,因此不久之后,现在有 6 个排队的接受构建作业.我希望验收构建项目像投票SCM"功能一样工作-完成后,开始最近排队的工作,跳过其余的工作.

I've got a commit build project in Jenkins which schedules an acceptance build project on completion. Since commits come in faster than the acceptance build job finishes, after a short time there are now six queued acceptance build jobs. I would like the acceptance build project to work like the "Poll SCM" functionality - On completion, start the most recently queued job, skipping the rest.

没有更多的技巧,我不能使用在其他项目建立之后进行构建",因为我需要将信息从提交构建作业传递到验收构建作业.

I can't use the "Build after other projects are built" without more hacks since I need to pass information from the commit build job to the acceptance build job.

推荐答案

@ l0b0,

Jenkins的行为是合并构建,以便队列仅包含当前正在运行的构建和一个排队的作业.仅当新入队的作业采用与队列中已有参数不同的参数时,深度才会增加.

Jenkins behavior is to coalesce builds so that the queue only contains the currently running build and one enqueued job. The depth only increases if the newly enqueued jobs takes parameters that differ from what's already on the queue.

因此,我正在收集您的下游(接受)作业需要某种参数,但是您需要提供有关其工作方式的更多详细信息.

So I'm gathering that your downstream (acceptance) job takes some sort of parameters, but you need to supply more details of how it's working.

如果您使用的是参数化触发器插件,您应该查看现有的SO线程

If you're using parameterized trigger plugin then you should check out this existing SO thread

更一般地说,您应该调查一下参数.听起来您好像将太多的信息从上游作业传递到下游作业,导致Jenkins队列将它们视为不同的参数,而此时并不一定如此.

More generally speaking, you should look into your parameters. It sounds like you are passing too much information from upstream to downstream jobs, resulting in the the Jenkins queue treating them as distinct parameters when then is not necessarily the case.

您是否将上一个成功的上游作业的运行编号作为参数传递?如果是这样,那么是的,您遇到了问题.相反,您应该使用升级版插件上游作业来标记上一次成功的构建,然后让下游作业简单地跳转到最近升级的构建.

Are you passing in the run number of the last successful upstream job as a parameter? If so, then yeah you've got problems. What you should do instead is use the Promoted Build Plugin on the upstream job to mark the last successful build, and then have the downstream job simply jump to the most recent promoted build.

希望有帮助.

这篇关于如何仅执行詹金斯中最新的排队作业?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 05:01