View deployment information in Bitbucket

See where your code is deployed on pull requests and commits in Bitbucket Data Center without having to go over to your deployment tool.


For Bamboo 8.1 and higher, deployment projects will automatically send deployment information to Bitbucket Data Center. For more details on integrating Bitbucket and Bamboo, see our Bamboo integration documentation.

For Jenkins 2.319.3+ and higher, use the following implementations:

  • For Freestyle jobs, this is implemented as a post-build action. The action will post an in-progress notification of the deployment during the Bitbucket SCM checkout, and a final notification during the post-build stage.

To create a post-deployment notifier to send deployment information to Bitbucket:

  1. Select Add post-build action > Notify Bitbucket Server of deployment.

  2. In the Post-build actions dialog, input the following:

    • Environment name (required) - the name of the environment being deployed to.

    • Environment type (optional) - the type of environment that was deployed to, for example, Production, Staging, etc. Choose none if a type does not apply.

    • Environment URL (optional)- if the environment has a URL, provide that here. Otherwise, leave blank.

    • Environment Key (optional) - unique identifier for the environment in Bitbucket. Leave it blank to have it automatically generated by the plugin.

  • For Pipeline and Multibranch Pipeline jobs, this is implemented as a wrapper step. The bbs_deploy step will post an in-progress notification to Bitbucket Data Center at the start of the block, and a final status at the end of the block based on whether the steps within the block were successful or not.

To set up notifying Bitbucket of the deployment status for Pipeline and Multibranch Pipeline jobs:

  1. From the Pipeline Syntax page, select Sample step > bbs_deploy.

  2. Provide an Environment name (required).

  3. Optionally, select an Environment Type, input an Environment URL, and Key.

  4. Select Generate Pipeline Script.

  5. Copy the generated code block, for example:

bbs_deploy(environmentKey: 'MY-ENV', environmentName: 'My Production Environment', environmentType: 'PRODUCTION', environmentUrl: 'http://url.to.prod') {
    // some block
}

      6. Edit the Jenkins file and add the copied code to within the steps block of the file. Your steps to do the deployment must be within the bbs_deploy step.

      7. Save or commit your changes.

For more details, see the documentation for the Bitbucket integration plugin for Jenkins.

If you’re using other integration tools, this can be done via the deployment status API.

Last modified on Oct 27, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.