Jenkins auto-build when git commit

In this tutorial, How to use Jenkins auto-build when git commit. You use a web-hook to capture when a new git commit was made and Jenkins will start to build jobs.

Configuration:

  • Jenkins Server
  • Github and Git plugins

Ref to Install Jenkins on AWS EC2.

Install the Git and Github plugins.

Under ‘Manage Jenkins’ -> ‘Manage Plugins’, select and install both Github and Git plugins.

Restart to finish the installation.

Configure a Jenkins job to use your repository.

Create a Jenkins job ‘Freestyle project

The first, You add repository in the “Github project” text field under the general settings.

you’ll need to enable Git under ‘Source Code Management‘.

Under ‘Build Triggers‘, tick ‘Github hook trigger for GITScm polling‘.

Add the hooks to Github.

Click “settings” your repository. For Example, My repository https://github.com/huupv/jenkins/settings/hooks . Click ‘Add webhook‘ as the picture.

Setting webhooks for Jenkins.

When you action commits to the repository Github, Then Jenkins will auto build job.

Testing it 🙂

, , ,

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created DevopsRoles.com site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment moderation is enabled. Your comment may take some time to appear.

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