如何在Jenkinsfile中设置一个github拉取请求? [英] How to set up a github pull request build in a Jenkinsfile?

查看:826
本文介绍了如何在Jenkinsfile中设置一个github拉取请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我一直在使用Jenkins。我使用Github Pull Request Builder插件设置了许多项目,以便在有人打开拉取请求时运行测试,然后在拉取请求实际合并到主人时触发其他任务(构建,推送,部署等)。



那么,有没有办法用Jenkinsfile或组织文件夹或多分支构建协议来设置它?

解决方案







So, I've been using Jenkins for quite a while. I have set up numerous projects with the Github Pull Request Builder plugin to run tests whenever someone opens a pull request, and then trigger some other job (build, push, deploy, etc) whenever the pull request actually gets merged to master.

So, is there any way to set this up with a Jenkinsfile, or the organization folders, or the multibranch build deal?

解决方案

The github-organization-folder plugin in combination with the multi-branch plugin plugin offers exactly this awesome feature: It scans a whole organization (optionally restricted to certain patterns in repo/branch names) for Jenkinsfiles and automatically adds jobs. This also happens for Pull Requests.

Once the PR is closed, it automatically removes the job.

To avoid arbitrary code execution, an organization member has to trigger building the job (same as for the GPRB plugin). The phrase can be configured in the Jenkins System settings.
EDIT: Under the Advanced section in Jenkins, you find options about what types of PR you want to build. If you build fork PRs, then there's afaik no way to prevent running code without prior inspecting it.


An example, how this looks like:


这篇关于如何在Jenkinsfile中设置一个github拉取请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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