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:
Has anyone set up webhooks to a Jenkins that is not publicly accessible? Are there better solutions to this problem?
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!
Hi, Bitbucket community! Are you a DevOps practitioner (or know one in your network)? Do you have DevOps tips, tricks, or learnings you'd like to share with the community? If so, we'd love to hea...
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