简体   繁体   English

在GitHub中创建拉取请求时触发Jenkins Multibranch管道

[英]Triggering Jenkins Multibranch pipeline when there is a pull request created in GitHub

I'm using Jenkins Multibranch pipeline. 我正在使用Jenkins Multibranch管道。 I've configured the APIs(github-webhook and ghprbhook) in GitHub. 我在GitHub中配置了API(github-webhook和ghprbhook)。 I want to trigger the Multibranch Pipeline whenever there is a Pull Request on GitHub (without using periodical option). 我想在GitHub上有一个Pull Request时触发Multibranch Pipeline(不使用周期性选项)。 For example, if i create pull request on GitHub, then the Jenkins Multibranch pipeline should start scanning and build the Jenkinsfile automatically. 例如,如果我在GitHub上创建pull请求,那么Jenkins Multibranch管道应该开始扫描并自动构建Jenkins文件。 What do i need to do to achieve this? 我需要做些什么才能实现这一目标? I would love to try if there are any suggestions. 如果有任何建议,我很乐意尝试。

Under the webhook section, you can choose Let me select individual events option. 在webhook部分下,您可以选择Let me select individual events选项。 Under that you can have push selected by default and also can select Pull Request which helps you to do wnat you are looking for Pull request opened, closed, reopened, edited, assigned, unassigned, review requested, review request removed, labeled, unlabeled, or synchronized. 在此之下你可以默认选择push ,也可以选择Pull Request ,它可以帮助你做你正在寻找的Pull request opened, closed, reopened, edited, assigned, unassigned, review requested, review request removed, labeled, unlabeled, or synchronized.

To achieve this, I have selected "Send me everything" under GitHub Webhooks section. 为实现这一目标,我在GitHub Webhooks部分选择了“发给我一切”。 Then I was able to trigger builds automatically whenever a PR is raised on GitHub. 然后,只要在GitHub上引发PR,我就能自动触发构建。

As @RSharma mentioned, I have selected only "Push and Pull Request" under "Let me select individual events" section. 正如@RSharma所提到的,我在“让我选择个别事件”部分下只选择了“推拉请求”。

PS: The GitHub branches are automatically detected in Jenkins. PS:在Jenkins中自动检测到GitHub分支。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM