I need to make my own script to remove the branch on the removal event from the Github. I use multibranch pipeline and Blue Ocean plugin.
Asked
Active
Viewed 2,279 times
0
-
Do you mean Git Lab ?? – rohit thomas Jun 20 '18 at 13:46
-
@rohitthomas Jenkins – Igor Jun 20 '18 at 14:39
-
1is there a question here? – dmulter Jun 20 '18 at 18:06
-
3Do you need execute some task in jenkins when branch is deleted in github? – JRichardsz Jun 20 '18 at 18:08
-
@Igor Since you are using multiBranch Pipeline you dont need to do anything since MultiBranch pipeline works on looking for a JenkinsFile in each Branch so if you delete a Branch from github itself there will be no JenkinsFile to locate since the branch will not be available when a scan is done for a detailed explaination look at https://stackoverflow.com/questions/37210799/jenkins-delete-jobs-when-branch-deleted-via-branch-indexing – rohit thomas Jun 21 '18 at 02:30
-
@JRichardsz yes i need execute some task. Because when Jenkins create a branch my task copy code to another directory and when github delete branch i need delete code from this directory. This is done for nginx configuration so that each branch had its own url – Igor Jun 21 '18 at 12:43
-
Are you using some webhook configuration in your github ? This could be help you https://jrichardsz.github.io/devops/devops-with-git-and-jenkins-using-webhooks If you want I can help you in your configurations. Regards – JRichardsz Jun 21 '18 at 20:59
1 Answers
0
I'm assuming you already have webhooks set up for push events. You will need to set up a similar webhook, but instead of using the push hook, use a delete hook, which is fired any time a branch or tag is deleted.

jayhendren
- 4,286
- 2
- 35
- 59