Missed Team ’24? Catch up on announcements here.

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

How do you setup webhooks from Bitbucket Cloud to Jenkins behind a firewall?

Roger Myung
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 19, 2020

I have Jenkins running in private subnet on AWS, which has no exposure to the public internet.  It is able to pull from Bitbucket Cloud, but I want to set up webhooks.

I found this blog post about using smee.io for Github: https://jenkins.io/blog/2019/01/07/webhook-firewalls/

However, it looks like there is a bug in smee when used with Bitbucket Cloud.  https://github.com/probot/smee-client/issues/116

I found 2 options:

  • https://webhookrelay.com/, which is a paid service that works similarly to smee.  I'm concerned we might hit the same problems.
  • Set up a public facing load balancer that redirects /bitbucket-hook/ to Jenkins.  I'm working on getting clearance to set this up.

Has anyone set up webhooks to a Jenkins that is not publicly accessible?  Are there better solutions to this problem?

1 answer

0 votes
Hakeem Olasupo
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 19, 2021

Step 1: Install the BitBucket Plugin in Jenkins

The first step involved in setting up BitBucket Webhook Jenkins Integration requires you to install the BitBucket Plugin in Jenkins. Follow the steps given below to install the plugin:

 

Login to your Jenkins account and open the Dashboard section.

Click on Manage Jenkins from the list of available options.

 

Now click on Manage Plugins and navigate to the Search bar. Enter Bitbucket Plugin in the search bar and install the same.

 

 

Step 2: Create a New Repository using BitBucket

Once you have installed the BitBucket Plugin in Jenkins, you will need a repository in BitBucket to link it with Jenkins. The second step in building BitBucket Webhook Jenkins Integration involves creating a new BitBucket repository. Follow the steps given below to do so:

 

Login to your BitBucket account using the appropriate credentials.

Once you have successfully logged in to your BitBucket account, click on the Create Repository button.

 

Add a name for your Project and Repository. You can also select the access level for your repository and make it private or public according to your needs. Once you are done filling all the required fields, click on Create Repository to save and create the repository.

 

Step 3: Create a New Job in Jenkins

Once you have the repository ready, go back to your Jenkins account and open the Dashboard.

Select the option New Item from the list of options available to create a new Jenkins Job.

 

Now navigate to the Source Code Management section and click on the Git radio button.

 

Add the link to your BitBucket repository that you created in the previous step to set up the BitBucket Webhook Jenkins Integration.

Navigate to the Build Triggers section and mark the option “Build when a change is pushed to BitBucket”. Then click on the Save button to save all the changes.

Step 4: Push Code to Jenkins using BitBucket Webhooks

The final step of the BitBucket Webhook Jenkins Integration is to configure it to push code-based changes to the Jenkins Server whenever new code is committed to the BitBucket Repository.

 

Open BitBucket and navigate to the Repository Setting page.

 

Select the option Webhook and click on the Add Webhook button.

Give a name to the BitBucket Webhook and add the Jenkins URL in the URL field. You can also skip the certificate verification.

Once you have filled the required fields, click on Save to save all changes.

 

Once you follow the above instructions in the correct sequence, you will be able to set up BitBucket Webhook Jenkins Integration in no time!

Aida Bijedic-Forslin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 2, 2021

This doesn't answer the original question. The scenario is that there is no publicly accessible Jenkins URL. 

Like # people like this
MartinSchwaller
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 24, 2022

It is super annoying that the documentation does not say anything reasonable about not using webhooks. Our setup worked for years with non-atlassian bitbucket plugin that everbody seems to be using. Now for an unknown reason its not working anymore and there is basically no way to debug this or track it in any way -.- 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events