Jenkins Trigger Build on Git Commit-Github Jenkins Integration

Jenkins Trigger Build on Git Commit-Github Jenkins Integration

GIT: git is a version control system which stores the precious code of the developer in reliable and secure environment.

Jenkins: Jenkins also an open source tool use for Continuous Integration and Continuous Deployment.

In this post we will see how to integrate Git and Jenkins in order to make the software development life cycle faster, smaller, simpler and secured. To integrate github and the jenkins server one needs to configure both the platform in order to make communication between them and make a secure pipeline.

 

Let’s first coming onto the git side:

we need to create a webhook which will notify the jenkins server when any commits are being made into the github repository. This webhook will trigger the jenkins server and then jenkins will start performing the designated task of making code build.

How to set web-hook in git?

Configure Github Web Hook For Jenkins

 

As show in the image, in the github console you can navigate to the settings, and into the settings can see the webhooks option. By clicking onto it, we can place the jenkins hook url to make the integration from github to jenkins. Enter URL of  jenkins server in playload URL as  jenkinsurl/github-webhook/ and in content type select application/Json. and in the which events you like to trigger this weebook select just the push event. this webhook work as when any develop committed any new code changes in repository github will trigger the jenkins hook.

Webhook Configuration in Jenkins

Coming onto the other side of the river, jenkins also needs to be configure in order to listen the coming request from the git to make the whole pipeline communicable.

now you can make the new pipeline and configure the source code management and integrate the git repository you wanted to communicate via jenkins.

Configure the git repository in jenkins

Below image shows , how to configure the git repository in jenkins job.

how to integrate git with jenkins

as shown in the image create a job in the jenkins, in the job configuration you can see different tabs like general, source code management, build triggers, build environment , build, post build actions.

in the source code management section select git and enter your git repository clone URL. if the repository is private you have to enter your github credentials. if you are using public github repository no need enter credentials.

Configure Triggers

jenkins with git

once git configure is over, we have to configure the triggers to build this job. in triggers select github hook trigger for Gitscm polling. this trigger receive the push notifications from github and run the job. thats it we have successfully integrated jenkins with git.

  • Jenkins GitHub Webhook
  • jenkins trigger build on git commit
  • trigger jenkins job on git commit
  • jenkins build when a change is pushed to github
  • configure jenkins to run build automatically on code push
  • how to trigger build automatically in jenkins when git commit
  • github webhook jenkins
  • github jenkins integration
  • jenkins trigger build on file change
  • jenkins not triggering build on push

Leave a Reply

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