在Jenkins中组合构建触发器

在Jenkins中组合构建触发器

本文介绍了在Jenkins中组合构建触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为一个作业配置了两个构建触发器(轮询SCM和FStrigger-MonitorFiles),比如说轮询计划为每日轮询(@daily),现在,如果poll SCM检测到更改或FStrigger-MonitorFiles可以触发构建是正常行为.

I have two build triggers (poll SCM and FStrigger-MonitorFiles) configured for a job, say the polling is scheduled for daily poll (@daily) , Now the build is triggered if poll SCM detects change or FStrigger-MonitorFiles does which is normal behavior.

但是,如果两个都检测到更改,则每次触发器尝试触发构建时都会触发两次构建,那么我该如何实现每天将上述两个触发器的结果组合在一起,并且仅触发/不触发一次构建.

But if both detects the change the build will be triggered twice as each triggers tries to trigger the build , how do i achieve combining the results of above two triggers daily and trigger/not trigger the build only once.

推荐答案

您可以创建为两个触发器安排的特殊触发器作业.通过使用系统常规脚本在此作业内部,您可以检查是否已构建目标作业的任何内部版本.然后根据检查结果,该作业是否触发目标作业.

You could create a special trigger job that is scheduled for both triggers.Inside this job by using system groovy script you could check if any build of the target job has been built today. Then according to the results of the check this job does or does not trigger the target job.

这篇关于在Jenkins中组合构建触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 02:29