Return to site

Jenkins Integration with Bitbucket/Github Webhook (Part III)

Jenkins Integration Webhook

· jenkins,bitbucket,github,webhooks,CI

This is a Part III of Jenkins series as in Part IIwe went through an installation and configuration of Jenkins. This is a Jenkins Integration with Bitbucket/Github Webhook.

Whenever you commit your changes or push something to your codebase or remote repository, your build on jenkins should start and that we can automate using the web-hooks integration.

Simliar steps you can follow if you are using GitHub rather than BitBucket for your codebase. Only url will alter that will see in the next section.

Integration with BitBucket

You need to install few plug-ins in Jenkins to achieve this. Here, is the list of plugins you can install on your Jenkins server. Few of them might be already installed with the recommended plugins as shown below

Go to Manage Jenkins →> Manage Plugins →> Available →> Type in Filter(Verify after the installation successful into the Installed section as in here) and once you install one plugin it will automatically install the dependent plugins :

  • Bitbucket Plugin
  • Github Plugin
  • Webhook to Jenkins for Bitbucket
  • Bitbucket Server Web Post hooks Plugin
  • Bitbucket Server

Log in into Jenkins Server and make necessary steps to configure your security inside Global security, install respective plug-in’s and then create a job by setting the Git Project and click the checkbox of “Build when a change is pushed to BitBucket” and save the project.

Then go to the Bitbucket repository, Settings →> Webhooks →> Add Webhook →> Add name as anything and url as http://19.128.43.75:8081/bitbucket-hook/

(Note: Remember to add the / after the bitbucket-plugin and your IP address is reachable to Jenkins server. Change the JENKINS_HOME directory if needed based on your codebase location and configure the system accordingly.)

Once you added the webhook, simply test it right there by loading new request and see if you received 200 OK response. That means you have configured it properly.

In case you are using Github, you can go to your github repository, Settings →> Integrations & Services →> Add service →> Search “Jenkins (Github Plugin)” →> Add name as anything and url as http://19.128.43.75:8081/github-webhook/

Then you are done. Make whatever changes in your code which will pull into the repository that will get reflected back onto the Jenkins Server and start the build process on server.

All Posts
×

Almost done…

We just sent you an email. Please click the link in the email to confirm your subscription!

OKSubscriptions powered by Strikingly