0.Expose local jenkins to the internet by ngrok
Currently in our Jenkins setup, we're deploying and working in local machine and not expose this to the internet.
So in order for github can access to the local Jenkins, we would need some tool to expose Jenkins to the outside world.
Here is how it works with ngrok tool.
You can download ngrok tool from the official site: ngrok site
After download and install, if you want to expose some local site to the outside, you need to specify the port and run the following command:
As in Windows : ngrok.exe http 8080 (example for port 8080 which is default port of Jenkins)
After that, you can use the following example address for working with github: https://27698b0d.ngrok.io
1.Setup webhooks
In order for Jenkins to know when there is any code change in github, you need to set the webhook.
Following is how to do it with github.
First, go to your dev repository → Choose webhooks
Click on Add webhook button, setup as the following:
Then choose Add→ If the icon is set to green, you're good to go (big grin)
2.Setup job build in Jenkins
Now it comes to Jenkins part.
First, you need to add Jenkins Job → Choose Configure
Set the source code management for git repository like below:
In the build trigger, set github poll for activate job when there is code changed in the repository:
That's it.
Thanks for reading.
Hope this helps.
Top comments (0)