Catch the event of removing a branch from github webhook - jenkins

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.

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.

Related

jenkins generic webhook trigger git. Option Filter not working

I am using jenkins generic webhook trigger git. i want to trigger build only when a push is made on branch which starts with PO.Used optional filter as ^(ref\heads\PO-[a-z0-9_-])+$ but was not working, can someone please help. when Optional filter is blank. the build gets triggered on master branch.

How to set up github webhook trigger on pushing in certain branch

I have Jenkins pipeline, and configured github webhook to trigger pipeline.
How to make triggering pipeline when the certain branch was pushed, instead of triggering pipeline by pushing to every branch ?
Webhook is generic for all, there is no filter on the side github or bitbucket, all you need to handle based on payload.
you can use Generic+Webhook+Trigger+Plugin,The plugin will allow you to parse certain data from the payload, and can conditionally trigger a build depending on the branch name.
Apply the filter with branch name
generic-webhook-trigger-plugin-specific-branch

Trigger building the Github's webhook head_commit in Jenkins

I have configured a Jenkins Pipeline that correctly receives webhooks push notifications from GitHub, on push events.
The authentication is done through a deployment key.
Jenkins configuration seems to rely a lot on the concepts of branches and pull requests.
Given my workflow, which consists mostly of creating branches for any needs, and merge changes back onto master once things would look fine on the CI, I do not really care about seeing my builds categorized by branch or PR.
I would prefer to see builds based on commits' hashes. I do not see the need to tell Jenkins what branch I want it to match.
My current configuration is not selecting the commit revision I desire. I do not understand how it decides which branch or commit to build, once it receives a push notification. In Jenkins I have set the branch to **.
Checking the webhook payload, I noticed that it contains both the list of commits but also something called head_commit, with its id property being the commit's hash I want to see being built.
I would like Jenkins to do the following:
Check what's the head commit in the webhook notification (head_commit.id in the payload)
Build that precise commit, no matter the branch it is part of
Setting a green tick or a red cross beside the commit's hash on Github
Is this possible?

Gerrit push to new branch does not trigger Jenkins job

I have a very peculiar problem on my Jenkins. Gerrit trigger works on first master branch usually. When I create a new branch and push something to it, the build is not triggered at all. Even when I do Query and Gerrit trigger patch it does not work. But, when I open the job configuration, Save and do a manual trigger it works. The next consecutive push work as normal again.

Build Jenkins project on BitBucket pushes and pull requests

I have a scenario where I'm setting up Jenkins for my app. I have BitBucket set up and firing appropriate webhooks.
I want to start a build whenever a push is made to the repo as well as whenever someone creates/updates a pull request.
I've looked at the BitBucket Plugin. It works good if I have the BitBucket webhook to fire for all pushes.
Then I added the BitBucket Pull request plugin to build on every pull request create/update. So I changed the BitBucket webhook preferences to fire on pushes and PR creates/updates.
Unfortunately, these plugins have conflicting settings, hence they cannot be used at the same time (as per my research, the minute I send custom webhooks from BitBucket, the first one stops working, but the second one works)
Has anyone been able to set this up correctly? Maybe there's a plugin for what I want, but I couldn't find it.
I want to keep writing a proxy in front of Jenkins to manage webhooks the last option, only if there really is nothing I can do.
Thanks for the help!

Resources