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.
Onur Baskirt is a senior IT professional with 15+ years of experience. Now, he is working as a Senior Technical Consultant at Emirates Airlines in Dubai.