It is not possible to add a webhook for the Jenkins running on local host as it doesn’t have a public URL exposed over internet. To resolve this issue we can use a tool like ngrok which will expose the local server to the public internet.
What is ngrok?
ngrok exposes local servers behind NATs and firewalls to the public internet over secure tunnels. It connects to the ngrok cloud service which accepts traffic on a public address and relays that traffic through to the ngrok process running on your machine and then on to the local address you specified.
– Public URLs for exposing your local server
– Public URLs for demoing from your own machine
– Public URLs for building webhook integration
How to setup ngrok on Windows?
– Go to ngrok website
– Click on Download for Windows link
– Unzip the downloaded file “ngrok-stable-windows-amd64” in any directory
– Open your command prompt
– Navigate to the directory where ngrok exe is present
– Enter command “ngrok version” to verify ngrok is working
Generate Public URL for your local server
– Run the following command ngrok http 8080
Public URLs for your local server are displayed:
Similarly, you can expose any local server to public internet.
To add a webhook for Jenkins, copy any of the url and paste in the Webhooks -> Payload URL for your Github repository as explained in the previous post.