Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Jenkins Trigger build on Bitbucket when merge branch

Hi, I am fairly new to Bitbucket/Jenkins and I am trying to get Jenkins to trigger a build when my branch is merged into master on Bitbucket.

First of all I have successfully been able to integrate my Jenkins with Bitbucket so when I do a push on my branch to Bitbucket via a webhook, it will trigger a build in Jenkins and grab all the files and push to the correct environment. I've noticed in the webhook there is a trigger for Merge however when select this does not trigger a build.

Is there any appropriate plugin for this I can download for Jenkins or any help and advice would be greatly appreciated.

Thanks

3 answers

We're having the same issue here with our BitBucket Cloud server and our Azure-hosted Jenkins server. I have the following setup:

Jenkins 2.164.2
'Build when a change is pushed to BitBucket' checked in Jenkins job (BitBucket Plugin installed)

In the BB repository, added a hook under Settings -> Webhooks:
Title: Jenkins
URL <our jenkins server>/bitbucket-hook/
Status: Active
Request History: Enabled
Triggers: Choose from a list
Pull Request - Merged ticked only

When I merge a pull request, the hook is triggered and 200 response comes back from Jenkins, but no build is triggered:

Untitled.png

In Jenkins I get a 'BitBucket Hook Log' tab but it just says 'Polling has not run yet'

1 vote

It is actually a rather typical automation problem which can be implemented with the Better DevOps Automation add-on.

Here is the step-by-step guide. It will just trigger the desired Jenkins build after every change even if that is a merge.

Note that there are other recipes available for more complex automation needs, like running a particular build if the "@build" command is in the commit message:

devops-automation-for-jira-jenkins-build

One workaround is to create one job per branch. But that is certainly not DRY.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Marketplace Apps & Integrations

Staying organized with Jira: best practices for a better project management

Project managers know this problem: A “mountain of work” lays in front of you, and you don’t know how and where to tackle them. Different to-dos lie ahead, but just one task after the other can be ha...

320 views 2 1
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you