Jenkins and GitHub Integration

In this article, I will describe how to integrate Jenkins with GitHub.

First, we need to download and install Jenkins.

Get initial password from C:\Program Files (x86)\Jenkins\secrets\intialAdminPasword

Install Jenkins with suggested plugins.

Create the First Admin User

Jenkins is Ready :) Start using Jenkins!

VERY IMPORTANT!!!! In order to run the windows batch commands without problem, USE JENKINS with ADMIN USER. Check the Jenkins service that its running by admin user!

In order to install Github Jenkins Plugin, go to Manage Jenkins –> Manage Plugins –>Avaliable (tab) –> Write “github” to the filter and install GitHub Plugin.

Then, we need to configure the plugin on Manage Jenkins page. Go to “Manage Jenkins –> Configure System” page.

At GitHub section, write “https://api.github.com as API URL.

Then, click to “Add” and add your GitHub credentials.

Then, test the connection.

On Jenkins main page, Click “New Item” and create “Free Style Project

Go to your Jenkins job, and click “Configure

Set your project URL as shown below:

Then, go to “Source Code Management” section and select “Git” then do the settings as shown below. (You can do additional settings based on your project.)

Then, do the Build Trigger settings with respect to your needs.

Go to your GitHub repository’s Setting and then Integration&Services and then click “Add Service” and select “Jenkins (GitHub plugin)“.

Then, click the “Webhooks” and set the Jenkins hook URL as the URL for your Jenkins machine and at last add /github-webhok/

and it is done! :) We finished the integration between Jenkins and our GitHub project. If your project has special build and test script, you need to add them at “Build” section of your Jenkins job. Also, you can add some post-build actions for reporting etc.

Thanks.
-Onur

4 thoughts on “Jenkins and GitHub Integration”

  1. Hi

    I can not stop thanking you for the good and fantastic work that you are doing. I have a question and am new to programming as well as using Jenkins, I have integrated github with Jenkins so once there’s a commit this automatically start jenkins but what I dont see is the browser opening at all but runs and pass the build.

    please can you assist me with this issue

    Thanks

    Reply
  2. hi.
    it is really a graceful solution for jenkins integrated github, i follow the guidelines step by step however i met this issue while add webhook in github. “We couldn’t deliver this payload: Couldn’t connect to server”

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.