尽管“不触发提交通知上的构建",但是仍然触发了Jenkins构建. [英] Jenkins builds being triggered despite "Don't trigger a build on commit notifications"

查看:358
本文介绍了尽管“不触发提交通知上的构建",但是仍然触发了Jenkins构建.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个管道作业,用于检出git存储库(让我们 调用是"repoA"),并将其传递给其他一些下游作业 进一步处理.上游作业的脚本存储在其他位置 git repo(我们称其为"repoB").该作业配置有民意调查 SCM"选项,以便对repoA进行任何更改都会触发它.在管道部分中,我选择了来自SCM的管道脚本"选项,并将其配置为从repoB的主分支中获取管道脚本.我还添加了该选项不要触发提交通知的构建."我期望的行为是,推送到repoA的任何更改都将触发该作业, 对repoB所做的任何更改都不会触发该作业.但是,当我推动 更改为repoB,便会触发作业.

我不知道这是否是错误,或者我是否缺少某些东西.

我正在运行Jenkins 2.7.4.我的主人Jenkins在Ubuntu服务器16.04.1 LTS上运行.我所有的Jenkins插件都是最新的.

解决方案

与Jenkins邮件列表进行了一些交流之后,我现在更好地了解了它的工作方式,因此在其他人需要的情况下,我必须要做的事情:

  • 创建一个git钩子,以通知Jenkins已经提交/推送了更改:最后,我们在远程上创建了一个post-receive钩子
  • 在工作中启用轮询,但将时间表留空
  • 在管道"部分中,将其配置为从git存储库中提取groovy脚本(在我的示例中为repoB),但不要添加以下行为:不要在提交通知上触发构建"
  • 确保在脚本中签出git存储库(在我的示例中为repoA)时启用轮询:默认情况下,如果未指定,则启用轮询

据我了解,不触发提交通知构建"选项是针对从钩子发出的通知,而不是我最初想到的来自作业轮询计划的通知.

I have a Pipeline job that checkouts a git repository (let's call is "repoA") and passes it to some other downstream jobs for further processing. The upstream job's script is stored in a different git repo (let's call it "repoB"). This job is configured with the "Poll SCM" option so that any changes to repoA will trigger it. In the pipeline section, I have selected the "Pipeline script from SCM" option and configured it to get the pipeline script from the master branch of repoB. I have also added the option "Don't trigger a build on commit notifications". The behavior that I'm expecting is that any changes pushed to repoA would trigger the job, and any changes to repoB would not trigger the job. Yet, when I push a change to repoB, the job is triggered.

I don't know if this is a bug, or if I'm missing something.

I am running Jenkins 2.7.4. My master Jenkins is running on Ubuntu server 16.04.1 LTS. All my Jenkins plugins are up to date.

解决方案

After some exchange with the Jenkins mailing list, I now understand better how things work so here is what I had to do in case other people need it:

  • Create a git hook to notify Jenkins that changes have been committed/pushed: on our end we created a post-receive hook on the remote
  • Enable polling on your job but leave the schedule empty
  • In the Pipeline section, configure it to pull the groovy script from your git repo (in my example it is repoB) but don't add the behavior: "Don't trigger a build on commit notifications"
  • Make sure polling is enabled when you checkout your git repository (in my example it is repoA) in your script: by default it is enabled if you don't specify it

As far as I understand, the option "Don't trigger a build on commit notifications" is for notifications comming from the hooks and not from the job polling schedule as I first thought.

这篇关于尽管“不触发提交通知上的构建",但是仍然触发了Jenkins构建.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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