BitBucket WebHook詹金斯 [英] BitBucket WebHook Jenkins

查看:504
本文介绍了BitBucket WebHook詹金斯的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想配置bitbutcket来触发jenkins构建.

I'd like to configure bitbutcket to trigger a jenkins build.

我花了一些时间对此进行研究,所有的答案都是几年前的,并且由于此后一切似乎都已发生变化,所以没有找到任何指南.

I've spent some time researching this and all the answers are from a few years ago, and have not found any guides because things seem to have changed since.

我要做什么: 将位桶推送到特定分支会触发构建.

What I'm trying to do: A bitbucket push to a particular branch triggers a build.

我所拥有的: Bitbucket Web挂钩,可在推送到任何分支时向Jenkins发出HTTP请求.我还在Jenkins上安装了Bitbucket插件,该插件在作业配置Build when a change is pushed to BitBucket中添加了一个复选框.尽管我在"SCM"部分中推送到已配置的分支,但此复选框似乎不起作用(也许我设置错了吗?为此需要的文档很少).

What I've got: Bitbucket web hooks which fires HTTP request to Jenkins on a push to any branch. I've also installed the Bitbucket plugin on Jenkins which adds a check box in the job config Build when a change is pushed to BitBucket. This checkbox doesnt seem to work (maybe I set it up wrong? minimal docs for this), despite me pushing to the configured branch in the SCM section.

问题1 :Bitbucket不会触发GET,而是另一个导致403的请求.我使用邮递员进行了测试,并且可以处理GET,但不适用于POST.

Problem 1: Bitbucket does not fire a GET, but another request which causes a 403. I tested with postman, and it works with a GET, but not a POST.

问题2::向任何分支的推送都会触发此HTTP构建请求.尽管构建仍限于特定分支,但似乎不必一直进行重建.

Problem 2: This HTTP build request is fired on pushes to any branch. While the build is still restricted to a particular branch, it seems unnecessary to be rebuilding all the time.

我该如何解决这些问题? Bitbucket在定制此功能时似乎不太灵活.用于Bitbucket的Jenkins插件有很多不好"的评论.开发人员目前如何进行此操作?

How do i address these issues? Bitbucket does not seem to be very flexible in customizing this. The Jenkins plugin for bitbucket has a lot of 'bad' reviews. How are developers currently doing this?

推荐答案

可以从您的位桶服务器访问您的Jenkins URL吗?如果是,那应该很简单.您在存储库中将Webhook添加为http://<url-of-jenkins>/git/notifyCommit?url=<url-of-repository>.当jenkins收到此POST时,它会自动触发那些使用git repo和您在webhook中提供的URL的作业的构建.
但是,您还需要确保将Build Schedule设置为空以用于那些作业.否则它不会被触发.您也可以在webhook URL中指定一个分支
在此处查看Push Notification from repository
https://wiki.jenkins.io/display/JENKINS/Git+Plugin

Is your Jenkins URL accessible from your bitbucket server? If yes that it should be fairly simple to do it. You add the webhook in your repository as http://<url-of-jenkins>/git/notifyCommit?url=<url-of-repository>. When jenkins receives this POST, it automatically triggers builds on those jobs that use this git repo with that URL you give in webhook.
But you also need to make sure your Build Schedule is set to empty for those jobs. otherwise it wont get triggered. You can specify a branch in webhook URL too
See the Push Notification from repository here
https://wiki.jenkins.io/display/JENKINS/Git+Plugin

这篇关于BitBucket WebHook詹金斯的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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