Setting up Webhook on localhost using ngrock (Jenkins)
Automate build on code commit
1. Ngrock Setup
- Download ngrok for Mac OS
- unzip and connect your account using terminal commands
- Start the service using ./ngrok http 8080
- Copy the Forwarding URL
2. Jenkins Configuration
It listens for requests at the hook URL. We need to give this URL to the GitHub repository. Jenkins will run the build process whenever code is pushed to the repository.
- Open Dashboard
- Go to Manage Jenkins > Configure System.
- Under GitHub select the ‘Advanced‘ tab.
- Check ‘Specify another hook URL for GitHub configuration‘ and paste the Forwarding URL copied from the terminal.
- Go to item configuration and underbuild trigger tab, check ‘GitHub hook trigger for GITScm polling‘
3. GitHub Repository Configuration
- Open Github Repository
- Click ‘Settings‘
- Click ‘Webhooks‘
- Click ‘Add webhook‘
- Paste the Forwarding URL in ‘Payload URL‘
- Only push events will be triggered with this webhook
- Click ‘Add webhook‘
Now try to commit and if everything goes well it will build automatically.
This post is licensed under CC BY 4.0 by the author.