使用git webhook触发多分支管道Jenkins作业无法正常工作

时间:2018-03-09 00:35:09

标签: jenkins

我有一个多分支管道作业,配置如下:

Job Config

还为其配置了轮询:

Poll Config

当新的提交被推送到其配置的Git仓库时,轮询后,Job按预期触发。在控制台输出中,Git repo记录为https://stash.example.com/scm/eg/project.git

但是当我尝试使用git notifyCommit webhook触发作业时,收到此错误消息:

$ curl 'http://jenkins.example.com/git/notifyCommit?url=https://stash.example.com/scm/eg/project.git'
No git jobs using repository: https://stash.example.com/scm/eg/project.git and branches:
No Git consumers using SCM API plugin for: https://stash.example.com/scm/eg/project.git

这里缺少什么?为什么詹金斯找不到这个仓库的任何工作/ git消费者来触发呢?

1 个答案:

答案 0 :(得分:0)

出现此错误的原因是,您在作业配置中使用了BitBucket插件,因此您无法通过通知请求使用curl请求触发构建。同样,GitNotify端点是Github插件的一部分,该插件扫描所有使用GitPlugin的作业配置,然后将curl请求的URL与git插件中使用的URL od repo进行交叉匹配。因此,如果您想使用bitbucket,请按照https://mohamicorp.atlassian.net/wiki/spaces/DOC/pages/381419546/Configuring+Webhook+To+Jenkins+for+Bitbucket+Bitbucket+Branch+Source+Plugin

上的说明进行操作