Automatic Build Configuration In Jenkins Using Webhook Of Bitbucket
Automatic Build Configuration In Jenkins Using Webhook of Bitbucket
Jenkins is providing multiple way of build triggering. One of them is automatic build trigger.
When we say automatic build trigger, it is not exactly automatic. It needs some action to trigger it. That action is when you commit new change and push to your codebase or remote repository the build will get triggered.
you commit your changes or push something to your codebase or remote repository
This can be done by integrating webhook of repository.
Integration of Bitbucket with Jenkins:
If you want to use codes from Bitbucket repository, you need to install jenkins plugin “Bitbucket Plugin”.
You can install the plugin through Manage Jenkins →> Manage Plugins →> Available →> Bitbucket plugin
Steps to integrate and configure webhook:
After install the plugin, create a job with Bitbucket repository url and credentials, under the Build Triggers section select “Build when a change is pushed to BitBucket” and save the job.
Configure Webhook from Bitbucket:
Login to your Bitbucket account and choose Repository -> Repository settings -> Webhooks -> add webhooks
Title you can give any name.
URL you can add your “jenkins_url/bitbucket-hook/”.
i.e.., “162.458.26.452:8090/bitbucket-hook/ “
(Note: Remember to add the “/” at the end of the url)
Thats it. We have done. After this configuration jenkins will start detect the changes. Once it finds changes in repository, it will start triggering the job. like this push event, you can change the event of triggering based on your project need.