Jenkins 使用 Bitbucket 服务器集成插件进行构建

发布于 2025-01-11 18:25:10 字数 976 浏览 5 评论 0原文

我可以通过 BitBucket 服务器集成插件触发 Jenkins 中的构建,该插件会自动在 BitBucket 上设置 Webhook。

我看到提出拉取请求时会触发构建。 但是,我注意到,当构建在 Jenkins 上运行时,如果拉取请求得到更新,那么我不会看到下一个构建在 Jenkins 中排队。 当更新的引用的当前构建完成时,构建确实会执行,但为什么我没有看到它排队? 如果存在多个拉取请求,则会出现相同的行为。

理想情况下,拉取请求应该能够同时构建。

我在 Jenkins 中有以下设置来触发并行构建。不确定,我在这里缺少什么

在此处输入图像描述

在此处输入图像描述

当拉取请求更新时,我确实看到从 Bitbucket 发送有效负载。

在 Jenkins 日志上,我发现了一个错误:

INFO com.atlassian.bitbucket.jenkins.internal.http.HttpRequestExecutorImpl handleError
Bitbucket - Path not found

如果找不到路径,那么我可以理解我这边存在一些配置问题,但是一旦当前构建完成,它就会触发另一个构建。

问题是:

  1. 为什么我不能使用 BitBucket 服务器集成插件并行构建多个拉取请求?
  2. 如果 Jenkins 确实在内部对构建进行排队,那么为什么它不显示在 Jenkins UI 上?

I am able to trigger builds in Jenkins via BitBucket Server Integration plugin which automatically sets a webhook on BitBucket.

I see build getting triggered when a pull request is raised.
However, I am noticing that when a build is running on Jenkins and if the pull request gets updated then I don't see next build getting queued in Jenkins.
Build does get executed when the current build completes for the updated ref but why don't I see it getting queued?
Same behavior is seen if there are multiple pull-requests.

Ideally, pull requests should be able to be built concurrently.

I do have below setting in Jenkins to trigger parallel builds. Not sure, what I am missing here

enter image description here

enter image description here

I do see payload being sent from Bitbucket when Pull request is updated.

And on Jenkins log I found an error:

INFO com.atlassian.bitbucket.jenkins.internal.http.HttpRequestExecutorImpl handleError
Bitbucket - Path not found

If path was not found then I can understand there is some configuration issue on my end but once the current build completes it does trigger another build.

Problem is:

  1. Why can't I build multiple pull request in parallel using BitBucket Server Integration Plugin?
  2. If Jenkins does queue the build internally then why doesn't it show on the Jenkins UI?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

森林散布 2025-01-18 18:25:10

我之前也遇到过类似的问题。
基本上我的理解是 Jenkins 无法区分来自 Bitbucket webhook 的事件。你基本上需要一个差异化因素。

我所做的是,根据有效负载输入对我的网络钩子侦听器作业进行参数化。

输入图片此处描述

在此处输入图像描述
输入图片这里的描述

这里对我来说最重要的是添加日期时间,因为我有很多请求几乎同时来自 bitbucket。

希望这对您的设置有所帮助。

I had similar issue before.
Basically what I understand is that Jenkins cannot differentiate the events that are coming from Bitbucket webhook. You basically need a differentiator.

What I did is, make my web-hook listener job parameterised based on the payload input.

enter image description here

enter image description here
enter image description here

Here the most important thing for me was to add the date-time, because I have many requests coming at almost same time from bitbucket.

Hopefully this will help in your setup.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文