Integrate Jenkins with BitBucket ~ build after each commit

February 03, 2019

   



    In this blog we will learn, how we can integrate our BitBucket Repository with Jenkins to continuous poll it for any modification and execute automation script in case of any changes.


For this purpose we need To Create Webhook in Bitbucket which is used to build Jenkins job after each commit.

1)     Login into BitBucket Account then to project which we wanted to integrate with Jenkins.

2)     Click on SettingsàWORKFLOWàWebhooks




3)     Click on Add Webhook and provide the Tittle and URL of Jenkins followed by bitbucket-hook/ (Please Note to add webhook Jenkins should be placed on public ip address, localhost won’t work in this case) and click on Save.


    4) Log in into Jenkins-->Manage Jenkins and Install BitBucket Plugin. Please make sure to restart Jenkins after plugin installation.



5) Now go to Jenkins Home Page create New Jenkins Job and in Source Code Management Select GIT, Provide the path of BitBucket Project.



6) Inside Build Triggers, Select Build when Change is pushed to BitBucket



7) Click on Apply and Save the Jenkins Job.

Now whenever any changes will be made to our BitBucket repository automatically Jenkins will trigger the build.

No comments:

Powered by Blogger.