Bitbucket Deployments


Track the deployments you execute through Bitbucket Pipelines and give your team insight into the status of your deployment environments and visibility over what code changes land in each environment.

Bitbucket Deployments supports deploying to the following three environments:

  • test
  • staging
  • production

Get started with Bitbucket Deployments

If you haven't configured Pipelines to perform deployments, refer to our deployment guides for your preferred platform.

Step 1: Enable Bitbucket Deployments

Click Deployments in the repository sidebar to start the set up process. If you have not enabled Pipelines, you will be prompted to configure a bitbucket-pipelines.yml file after selecting a language template.

Step 2: Configure your deployment steps

You can modify your bitbucket-pipeline.yml file to define which steps deploy to which environments.

For example: add deployment: test to the step that performs the deployment to your test environment.

Currently Bitbucket Deployments supports deploying to teststaging, and production type environments and whichever you use they must be listed in this order in each pipeline.

Commit the update to your bitbucket-pipeline.yml file and run your deployment pipeline.

Example bitbucket-pipelines.yml file
image: node:7.5.0

pipelines:
  default:
    - step:
        name: Build and push to S3
        script:
          - apt-get update
          - apt-get install -y python-dev
          - curl -O https://bootstrap.pypa.io/get-pip.py
          - python get-pip.py
          - pip install awscli
          - aws deploy push --application-name $APPLICATION_NAME --s3-location s3://$S3_BUCKET/test_app_$BITBUCKET_BUILD_NUMBER --ignore-hidden-files
    - step:
        name: Deploy to test
        image: aneitayang/aws-cli:1.0
        deployment: test
        script:
          - python deploy.py test
    - step:
        name: Deploy to staging
        image: aneitayang/aws-cli:1.0
        deployment: staging
        trigger: manual
        script:
          - python deploy.py staging
    - step:
        name: Deploy to production
        image: aneitayang/aws-cli:1.0
        deployment: production
        trigger: manual
        script:
          - python deploy.py prod

Step 3: Track your deployments

Once your deployment step has run, you can track your deployments on the Deployments page.

Deployments dashboard

The Deployments dashboard shows a summary of the status of the environment, which version of software is running in each environment, and a complete history of earlier deployments. 

Only deployments and environments with deployment tracking enabled in your bitbucket-pipelines.yml will be visible on the Deployments page.

Deployment review and promotion

If you've made a deployment step manual, you will see a Promote button on the Deployments dashboard. Clicking on the Promote button launches the deployment preview screen which allows you to review the commits and the file changes that will be deployed. If it looks good, click Deploy and we'll trigger your manual deployment step.



Note: you can only have one in-progress deployment in each environment. Any later pipelines that deploy to the same environment will be automatically paused. You can manually resume the paused deployment step once the in-progress deployment completes.

Deployment history

By clicking on the history icon, , you can see a history of all earlier deployments to an environment. Clicking on any deployment on the dashboard will load a summary showing the changes that were deployed, along with information about when it was deployed and by whom.

Deployment summary

The deployment summary is triggered by clicking on a deployment in the environment summary or in the history list. The summary shows information about the deployment including:

  • The environment it was deployed to
  • The previous deployment in the environment
  • The status of the deployment
  • Who triggered the deployment (if the deployment was a manual step)
  • The date the deployment occurred
  • A full list of commits in the deployments
  • A file diff between the new deployment and the previous deployment in the environment
  • Any linked Jira issues you've mention in the commit message


Link Jira and Deployments

If you use Jira to keep track of work, you can link your Jira. Once they are linked, issues related to a deployment show up on the deployment summary and deployment preview screens, and your deployments will show up in your related Jira issues. Just add the issue key, or keys, to your commit message and we'll do the rest.

For example:

git commit -m "PT-323 Add created workers to container cluster"


In Bitbucket we see:

deployment preview

In Jira we see:

If you rerun a successful deployment, Jira will continue to show the details of the first successful deployment, rather than any reruns.

Last modified on Nov 27, 2018

Was this helpful?

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