Set branch non mergeable

妖精的绣舞 提交于 2020-01-15 03:40:09

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/40221242/set-branch-non-mergeable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!