合并分支时,Jenkins构建触发两次 [英] Jenkins build triggered twice when merging branch
问题描述
具有Jenkins集成的项目已选择选项:将更改推送到BitBucket时生成.一切正常,直到其他分支合并到master.在这种情况下,詹金斯触发了两个构建.有人遇到过这个问题吗?
A project with Jenkins integration has selected option: Build when a change is pushed to BitBucket. Everything works as expected until some other branch is merged to master. In this case Jenkins triggers two builds. Has anyone experienced this issue?
推荐答案
像您一样,我只在 master 分支遇到过相同的问题.有效的解决方案是通过将Poll SCM -> Schedule
文本框保留为空白(不输入Cron表达式)来更新两次触发的作业的Build Triggers
配置.因此,正确的配置是仅标记两个触发选项:
I have experienced the same issue only for master branch, like you. The solution that worked was to update Build Triggers
configuration of the job that was triggered twice by leaving Poll SCM -> Schedule
text box empty (no Cron expression entered). So the proper configuration is to only mark the two trigger options:
-
[✓]
将更改推送到BitBucket时生成 -
[✓]
投票SCM (将时间表" 文本框留空)
[✓]
Build when a change is pushed to BitBucket[✓]
Poll SCM (leave the Schedule text box empty)
如果 Jenkins Job DSL 插件用于生成构建作业,应该包含正确的triggers
块(与上面的屏幕相对应):
In case Jenkins Job DSL plugin is used for generating the build job, it should contain proper triggers
block (which corresponds to the above screen):
triggers {
bitbucketPush()
scm('') // empty Cron expression string
}
这篇关于合并分支时,Jenkins构建触发两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!