设置分支不可合并 [英] Set branch non mergeable

查看:152
本文介绍了设置分支不可合并的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我的詹金斯管道不是绿色的,我想将我的分支标记为不可合并.

这样的想法是,如果詹金斯(Jenkins)中该分支的管道不是绿色的,则避免团队中的人将一个分支合并为master.

任何想法都可以在Github网页上使用任何jenkins插件吗? 就像我说的那样,例如,如果我的分支出现故障,则不要单击该分支的github页面中的合并按钮.

致谢.

解决方案

对于GitHub上的CI/CD,这应该非常简单.

三个步骤:

  1. 确保jenkins的部署"步骤仅在成功之后"进行.如果步骤不是绿色的(如您所说),您将不允许任何操作
  2. 确保您的Jenkins已正确连接到GitHub存储库. (很可能通过Webhook)
  3. 在GitHub UI中,您可以指定CI条件.转到您的存储库,然后在master上单击 Settings -> Branches -> Edit (或任何默认设置)分支是.)

在分支"页面上有一个复选框,名为"Require status checks to pass before merging".通过选中此选项,除非您的CI/CD步骤通过,否则您将使每个合并拉取请求"按钮变为灰色.

I would like to mark my branch as non mergeable, if my jenkins pipeline is not green.

The idea is avoid people in the team to merge a branch into master if the pipeline for that branch in Jenkins is not green.

Any idea is there´s any jenkins plugins to make this happens in Github webPage?. The idea like I said is, that if for example my branch has some failures, do not allow click the merge button in github page for that branch.

Regards.

解决方案

For CI/CD on GitHub, this should be fairly simple.

Three Steps:

  1. Ensure that the Deployment step from jenkins is only on "After Success". You don't want to allow anything if the step isn't green (as you say)
  2. Make sure your Jenkins is hooked up appropriately to your GitHub repository. (Most likely via a Webhook)
  3. From the GitHub UI, you are able to specify CI conditions. Go to your Repo, and click Settings -> Branches -> Edit on master (or whatever your default branch is).

There is a checkbox, on the Branches page called "Require status checks to pass before merging". By checking this, you will be graying out every "Merge Pull Request" button unless your CI/CD steps pass.

这篇关于设置分支不可合并的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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