Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

Setup webhooks with Jenkins and BitBucket

I'm using the Post Webhooks for Bitbucket and Bitbucket Branch Source Plugin   plugin for Jenkins, per this cloudbees article. I'm using BitBucket 5.5.1 and Jenkins 4.26.1.

 

What type of URL should I use? What is an example of a sample URL used to kick off a multi-branch pipeline job??

 

The wiki for the Post Webhooks for Bitbucket plugin does not specify any examples.

The aforementioned Cloudbees article shows

 $JENKINS_URL/bitbucket-scmsource-hook/notify/ 

but there I've tried every possible variation of that url:

  • https://$JENKINS_URL/$JOB_PATH/bitbucket-scmsource-hook/notify/
  • https://$USERNAME:$API_KEY@$JENKINS_URL/$JOB_PATH/bitbucket-scmsource-hook/notify/
  • https://$JENKINS_URL/$JOB_PATH/notify/
  • https://$USERNAME:$API_KEY@$JENKINS_URL/$JOB_PATH/notify/
  • https://$JENKINS_URL/$JOB_PATH/notifyCommit/
  • https://$USERNAME:$API_KEY@$JENKINS_URL/$JOB_PATH/notifyCommit/

And I cannot get a job to kick off.

2 answers

If you're feeling like trying a new app I recommend you check out this app my team developed Webhook to Jenkins for Bitbucket.

Here is a list of features that our application offers that you can't do with simple Webhooks:

  • Support for project-level configuration.
  • Data center optimization
  • Support for adding multiple Jenkins servers.
  • Support for build parameters.
  • Easily test and debug your configuration on the hook settings screen.
  • Ability to retrigger builds manually from the pull request screen.
  • Highly configurable, with options to ignore certain committers, branches and more.
  • Support for Bitbucket Mirrors

Trying to get the BitBucket branch plugin to auto-register the hooks for me.

 

First problem I have is that it doesn't add new web hooks even though I have the option selected under Global Configuration.

Even if I could get it to do that, what $JENKINS_URL will it use. Our instance of Jenkins isn't exposed on the web. What I have is a reverse proxy that simply exposes  /bitbucket-scmsource-hook/notify/, therefore the $JENKINS_URL differs from the value specified within the global configuration. 

I know with the GitHub plugin it allows you to specify what the Endpoint is. 

I have the same issue with attempting to use webhooks with Jenkins from bitbucket. I'm running on a trial bitbucket server install. I've been unable to get the post webhook to notify the jenkins job. I was able to get the Jenkins Bitbucket Branch Source plugin to auto create the webhook for me but it appears that the bitbucket add-on is unable to communicate properly with the jenkins plugin, I'm also using http://jenkins_url:port/bitbucket-scmsource-hook/notify/

Jenkins doesn't like the request.

Jul 12, 2018 5:24:38 PM com.cloudbees.jenkins.plugins.bitbucket.hooks.BitbucketSCMSourcePushHookReceiver doNotify
INFO: Received unknown Bitbucket hook: pullrequest:comment. Skipping.

Versions

Jenkins: 2.121.1

Bitbucket Source Branch Plugin: 2.2.12

Bitbucket Server: 5.11.1

Post Webhooks for Bitbucket:  1.6.2

Unsurprising I've been successful with the PAID add-on "Webhook to Jenkins for Bitbucket".

I was able to get the Bitbucket Branch Source Plugin to work in two really great ways.

1. Jenkins creates multi-branch pipeline builds for every repository in my Bitbucket Project

2. Jenkins adds a post webhook to each repository that triggers a branch build on commit.

I was initially missing something in the Jenkins Global Configuration section.  That is, the newer version of the Bitbucket Branch Source Plugin required me to select "Webhook implementation to use" as "Plugin".  And I had to install the Post Webhooks for Bitbucket plugin because of my older 5.10.1 version of Bitbucket.  Then the Jenkins plugin used the Bitbucket plugin to create a "Post Webhook" as seen on a repository admin page.  Not a native "Webhook".  Once I got that working I needn't concern myself with the proper notify URL because the plugins took care of it all.

Life is good!

We are having Jenkins under firewall and using bitbucket cloud is there any way we can configure reverse proxy webhooks that can trigger Jenkins jobs if there is any change in repo?

 

Thanks

Suggest an answer

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

5 mobile apps for Jira Cloud to boost productivity

  It’s very important to have access to the workflow process from anywhere. Especially if you manage the work of others. There is no difference whether you’re out of office, or drive a ca...

209 views 2 5
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