Jenkins没有在分支创建/删除上开始新的构建

时间:2016-06-16 16:24:31

标签: git jenkins bitbucket webhooks

想法: 每次推送到git repo时,都应该启动新的Jenkins任务构建。如果更改是:

  • 创建了新分支 - Jenkins将获取源代码,进行一些设置并运行Docker容器,可以测试此分支等。
  • 新推 - 詹金斯应重建源
  • 分支已删除 - Jenkins应删除已构建的文件,删除DB,关闭容器等。

设置:

  • 指向Jenkins网址的webhook的BitBucket repo
  • Jenkins使用BitBucket插件在本地服务器上运行,任务是“将更改推送到BitBucket时构建”

问题:

当创建/删除分支时,BitBucket webhook会触发,Jenkins正在处理请求(到目前为止,这么好)。

在Jenkins日志中,我看到: “收到了...的提交挂钩通知”但“BitBucket挂钩日志”屏幕显示以下内容:

    Polling SCM changes on master
Using strategy: Default
[poll] Last Built Revision: Revision 
.....
.....
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repositories
 > git config remote.origin.url ...
Fetching upstream changes from ...
 > git --version # timeout=10
using .gitcredentials to set credentials
 > git config --local credential.username ....
 > git config --local credential.helper store --
 > git -c core.askpass=true fetch --tags --progress ... +refs/heads/*:refs/remotes/origin/*
 > git config --local --remove-section credential # timeout=10
Polling for changes in
Seen branch in repository ....
Done. Took 6.6 sec
No changes

所以它基本上说没有变化,而且工作没有运行。 如果我进行了代码更改并将更改推送到BitBucket,则作业将按预期启动并且运行正常。

如何强制Jenkins在分支创建/删除时启动新构建?

0 个答案:

没有答案
相关问题