Jenkins Tutorial: Configure (SCM) GitHub Triggers and Git Polling using Ngrok

Written by: Evan Glazer

2 min read

Editor's Note: This is a guest blog from Evan Glazer.

OVERVIEW

Jenkins is the leading open source automation server. It provides hundreds of plugins to support building, deploying and automating any project. In this article, we're going to look at how to configure GitHub triggers on our jobs and communicate with GitHub using a webhook indicating when to poll the job to build changes made on the project.

PREREQUISITES

You will need to have a project in GitHub.

You will need to have a Jenkins Server up and running.

GETTING STARTED

Installing and Running Ngrok

Ngrok is a reverse proxy that accepts traffic on a public address, relays that traffic through to the ngrok process running on your machine and then on to the local address you specified.

So head on over to Ngrok and signup for an account, using whichever method you choose. Then you should be greeted with the screen below showing how to unzip and run it.

Now lets run ./ngrok http 8080 which will point to our Jenkins server.

You will receive your proxy hostname after running that command and it should look like this:

Forwarding http://xxxxx.ngrok.io -> http://localhost:8080

Forwarding https://xxxxx.ngrok.io -> http://localhost:8080

Setting up GitHub Webhook

So head on over to your GitHub project and click settings, on the left side panel you should see webhooks , now click that.

Let's add our webhook:

Setting up Jenkins Project or Pipeline Job

Select GitHub hook trigger for GitScm Polling:

Now let's set up the Jenkins Pipeline with your GitHub account:

We're ready to test our work! Push a commit to your project with the branch you specified develop , controller , etc.

Once pushed you should start to see your job build the latest push, and you can head over to GitHub Hook Log and check if the webhook proxied through Ngrok .

We did it!

Stay up to date

We'll never share your email address and you can opt out at any time, we promise.