By integrating Post Webhooks for Bitbucket with Azure DevOps Pipelines, you can achieve tighter integration between your Bitbucket repositories and your CI/CD workflows, enabling seamless automation and ensuring that your code is always up to date and properly deployed.
Getting the personal access token
To move forward with the configuration of Azure DevOps Pipeline triggering, we recommend you first obtain a Personal Access Token (PAT) to connect your Confluence and Azure DevOps instances. You can use a service account to generate this PAT but do remember that Microsoft forces you to log in every 90 days to keep the PATs active.
The following steps will help you create a new Personal Access Token:
Navigate to the User Settings in the right corner of the navigation menu.
From the drop-down, select Personal access tokens.
Click on the New Token button and generate a new personal access token with minimal scope. Currently, the App needs the token to Read access to the builds.
Alternatively, you can use this official guide from Microsoft.
Once you have got the Personal Access Token, you can proceed with the configuration of Azure DevOps Pipeline triggering. Configuration of Azure DevOps Pipeline triggering is available on all configuration levels:
Find our application Post Webhooks on the level that suits your needs best: Global, Project, or Repository.
Click on Add webhook button in the left corner and create a new configuration.
Tick the checkbox Trigger Azure DevOps pipeline and specify all the necessary parameters.
After you have specified all the necessary parameters click on the Save button.
Below you can find a short definition of the parameters you have to specify:
the name of the configuration
Our advice is to name something meaningful to you and your team so that it can be understood later easier
allows you to specify the Azure DevOps pipeline that should be triggered when the webhook event occurs.
a link to the pipeline by pattern:
specifies where the target pipeline is located:
the personal access token (PAT) used for authentication with Azure DevOps.
the branch in the Azure DevOps repository where the pipeline to be triggered is located.
additional parameters or variables that need to be passed to the Azure DevOps pipeline when triggering it.
allows you to specify the types of events that should trigger the pipeline.
The rest parameters are optional to provide flexibility and customization options to tailor the webhook integration according to your specific needs.
Azure DevOps pipeline parameters
If you want to update the build status in Bitbucket from the Azure DevOps pipeline, you may need to use some defined parameters. For some Bitbucket events, some parameters are not available and as a result, they are not sent to the Azure DevOps pipeline.
The following parameters are passed to the pipeline when it is triggered:
the Bitbucket project key.
the Bitbucket project’s name.
the Bitbucket repository slug.
the Bitbucket repository's name.
the git commit hash.
optional commit message.
the git branch name.
the git source branch for pull request events.
the git destination branch for pull request events.
the user's (actor) display name.
the user's slug.
the event type.
the id of the pull request (only pull request-related events).
the title of the pull request (only pull request-related events).
the description of the pull request (only pull request-related events).
the state of the pull request (only pull request-related events).