How to configure webhooks in Bitbucket to trigger a build in Jenkins? How to trigger automated builds in Jenkins through Bitbucket?

Webhooks are triggers that enables developers to trigger Jenkins jobs automatically every time there is a code change. Jenkins builds can be triggered by following ways:

  • pull - using poll scm
  • push mechanism - by triggering a build from Bitbucket or GitHub for every repository changes.
  • Slack commands

we will see in this article how to trigger (push) build in Jenkins for every change in bitbucket repository:

Install Bitbucket plug-in Jenkins:

Changes needed in Jenkins
Select the job you would like to configure Webhook is for. Click on configure, under Build triggers section, click on Build when a change is pushed to Bitbucket. Save the build job.

Changes needed in Bitbucket
1. Go to Bitbucket, choose the repository where you have your webapp configured., go to settings, click on web hooks.
2. enter title, url which should be like --> http://jenkins_server_url/bitbucket-hook/
for e.g.,

3. status should be active.
4. click on skip certificate verification
5. triggers --> repository push
Click save. you should be able to see the webhooks.

Now click on View requests. Make sure the url is correct

Now make a code change in Bitbucket to see if that triggers a build in Jenkins automatically.
You can also watch the steps in my YouTube channel as well:

Post a Comment