Bitbucket Data Center 7.16.0 introduced a deployment status API to allow third-party integrations to send through deployment information so that the deployment can be displayed inside Bitbucket Data Center on commits or pull requests.
As of version 3.1.0 of this plugin, you can configure deployment-related jobs to send notifications to this API. This feature supports freestyle, pipeline, and multibranch pipeline jobs.
You can configure freestyle jobs to use deployment notifications using post-build actions. Go to the Post-build Actions section, click Add post-build action, and select the Notify Bitbucket Server of deployment option.
You will then need to populate the following fields:
- Environment Type: The type of environment deployed to, or 'None' if the environment type does not apply.
- Environment Name (required): A human-readable display name for the environment that was deployed to.
- Environment Key (optional): This is a unique identifier for the environment in Bitbucket Server. You can name it
something readable like
MY-ENV
, or you can leave it blank and have it auto-generated by the plugin.
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.
You can also implement deployment notifications with pipeline and multibranch pipeline jobs by using 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.
Example:
bbs_deploy(environmentKey: '47f1081b-899f-42c5-b0ad-4778ca664b34',
environmentName: 'My Production Environment',
environmentType: 'PRODUCTION',
environmentUrl: 'http://url.to.prod') {
// some block
}
The environmentKey
and environmentName
fields are required. You can use the pipeline syntax snippet generator to
generate an environmentKey
, or you can use something more readable as long as it is unique across all environments
used by the repository.