Bitbucket Integration

Issue

  • I would like to trigger Jenkins from Bitbucket Server/Cloud repositories

Environment

Resolution

On every Git repository there is a hidden .git folder and inside the .git folder there is a hooks subfolder. This folder can hold scripts that are executed by Git when it performs certain operations. This feature is well documented (see Customizing Git - Git Hooks in the Git documentation).

Bitbucket Cloud and Bitbucket Server provide support to create hooks for your repositories. But implementations are different:

This difference in implementations is one of the reasons why solutions differs in Jenkins whether you use Bitbucket Cloud or Server. Plugins are often designed to integrate with one solution only.

Configuration

Note: We strongly encourage to use Pipeline and Pipeline Multibranch.

In order to better guide you through this, have a look at the article that correspond to your environment:

Troubleshooting

To troubleshoot issues with any of these solutions.Please have a look at:

Have more questions?

2 Comments

  • 0
    Avatar
    Frans Flippo

    I know you "strongly encourage to use Pipeline and Pipeline Multibranch.", but is there any way to show the build status (for a preconfigured branch, say master) in BitBucket when the build is a traditional (non-pipeline) Jenkins job? Currently no build status (e.g. green check) is shown for these projects.

     

    Thanks, Frans

  • 0
    Avatar
    Allan Burdajewicz

    Hello Frans,

    There are 2 plugins to achieve this with non pipeline jobs:

    Those can be used in pipeline too to update commit statuses at any time during the build.

Please sign in to leave a comment.