In this post we can explore how to integrate GitHub repository with jenkins CI server.
This blogpost talks about installing GitHub plugin on jenkins server, configuring GitHub repository on jenkins and creating service hooks on GitHub which will trigger build process as soon as someone’s commit new code to GitHub repository.
INSTALL and CONFIGURE GITHUB PLUGIN ON JENKINS
To install GitHub plugin, navigate to your Jenkins Dashboard, click on “Manage Jenkins” and select “Manage Plugins”.
On the plugins page, select “Available” tab and search for “GitHub plugin” under “External Site/Tool Integrations”.
Install the plugin. This will restart Jenkins server.
Once done, navigate back to dashboard for “Manage Jenkins” and select “Configure System”. Under that, you might observe that Git is not installed.
If so, login into your EC2 instance and issue command :
# yum install git
Once done, please go further down the page and provide your username and email details for GitHub account.
That’s it !! We have installed and configured our GitHub plugin on jenkins.
CREATE JENKINS JOB AND CONFIGURE GITHUB REPOSITORY
After installing GitHub plugin, it is time to create Jenkins job and integrate GitHub repository to it.
On Jenkins dashboard, click on “New Job” and provide name to “Build a free style software project” job.
Provide the path of GitHub repository under “GitHub Project” and provide “repository URL” for “GIT” under “Source Code Management”.
Lower down the page, don’t forget to enable “Build when a change is pushed to GitHub”.
Now, we have configured Jenkins job in such a way that whenever a change is committed to GitHub repository - this will trigger build process on Jenkins.
CONFIGURE GITHUB SERVICE HOOK
To trigger the build process on Jenkins, we need to configure service hook on GitHub. In order to achieve this, navigate to GitHub repository settings and configure Jenkins Hook URL for GitHub plugin.
The URL format : http://<jenkins-username>:<jenkins-password>@<Elastic-IP-Address>:8080/github-webhook/
That’s it !! GitHub is now integrated with Jenkins. If any developer commits any code to GitHub repository, this will trigger the build process on Jenkins.
This article was originally posted @http://sanketdangi.com/post/62740311628/integrate-jenkins-github-trigger-build-process
No comments:
Post a Comment