0

We have a pipeline that is triggered after the Pull request is merged in GitHub branch. And what I want is if the build fails in any of the stages of this pipeline after it has been triggered, I want to lock that branch in the GitHub. Could you help me in knowing how can that be done? We are using Jenkins 2.104. I would really appreciate your help.

The workflow is as follows (link to image)

  1. The code is merged on branch1 which triggers a build on pipeline1
  2. If pipeline1 fails it locks the branch1 so that there is no more trigger from branch1 to pipeline1, in the meanwhile user will figure out why pipeline1 failed and unlock the branch1
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
sanju000
  • 36
  • 4
  • These questions could help you: https://stackoverflow.com/questions/29336828/github-enable-branch-lock?lq=1 and https://stackoverflow.com/questions/10381672/how-to-protect-master-in-github – Felipe Augusto Jun 07 '18 at 17:58
  • Do you mean *branch protection*? I'm very curious why you would want to protect a branch that fails to build. In my experience you would want someone to update that branch ASAP to fix it. – Dan Wilson Jun 07 '18 at 18:20
  • Hi, @DanWilson. I have updated the question. For now, this is what I want to do. If you can guide me how this can be done, I would really appreciate. I am pretty new, so I will also appreciate your patience. Thank you. – sanju000 Jun 07 '18 at 19:32
  • @FelipeAugusto, thank you for the references. I have added more to question....for now that is what I want to achieve. – sanju000 Jun 07 '18 at 19:36

0 Answers0