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

Written by: Evan Glazer

2 min read

Stay connected

CloudBees Software Delivery Management communication feed.

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 , master , 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.

Your ad blocker may be blocking functionality on this page. Please disable for an improved experience.
Loading form...