The ZEIT Now for Bitbucket integration automatically deploys your Bitbucket projects with ZEIT Now, providing preview URLs and automatic production domain updates.

ZEIT Now for Bitbucket provides:

  • Automatic deployments for every push to branches and pull requests to preview changes live.
  • Updates production domains with the most recent changes from the default branch.
  • Instant rollbacks when reverting changes that have been made to production domains.

Commits pushed to Bitbucket are automatically built and deployed with Now.

Set up ZEIT Now for Bitbucket

Step 1: Link ZEIT Now to Your Bitbucket Account

You can connect your Now account to Bitbucket by visiting your account or team settings page and clicking the "Connect with Bitbucket" button.

The ZEIT Now for Bitbucket installation section within the account or team general settings page.

Next, you will need to authorize the Now application on Bitbucket with your account.

Once authorized, you will be redirected back to your ZEIT account or team settings page.

Step 2: Link Bitbucket Projects

ZEIT Now only deploys Bitbucket projects you have explicitly linked to from the Bitbucket control block in your account or team settings page, depending on where you linked your Bitbucket account. Without linking a project, no deployments will be made.

You can link projects across all the Bitbucket namespaces you have access to and unlink a project at any time.

You can also link a Bitbucket project from the New Project page:

Linking a Bitbucket project.

Sign Up or Login with Bitbucket

If you have, or will have, connected your personal Bitbucket account to your ZEIT Now account, you can login with Bitbucket from our login page.

Alternatively; if you do not already have a Now account, you can sign up to ZEIT using your Bitbucket account from the sign up page.

Login to ZEIT with Bitbucket.

Default Behavior

A Deployment for Each Push

ZEIT Now for Bitbucket will deploy each push by default. This includes pushes and pull requests made to branches. This allows those working within the project to preview the changes made before they are pushed to production.

With each new push, if Now is already building a previous commit, it will cancel that current build to start the most recent commit, ensuring you always have the latest changes deployed as quickly as possible.

Updating the Production Domain

If production domains are set from the project domains dashboard, pushes and merges to the default branch (commonly "master") will be made live to those domains with the latest deployment made with a push.

If you decide to revert a commit that has already updated a product domain, the previous commit's deployment will automatically be made available at the production domain instantly; providing you with instant rollbacks.

Preview URLs for Each Pull Request

The latest push to any pull request will automatically be made available at a unique preview URL based on the project name, branch, and team or username. These URLs will be given through a comment on each pull request.

A preview URL created from a pull request.

Included Environment Variables

You may want to use different workflows and APIs based on the environment of the deployment based on Git information. To support that, ZEIT Now will deploy your app with the following built-in environment variables when deploying with ZEIT Now for Bitbucket:

Variable Key
Description
BITBUCKET_DEPLOYMENT
An indicator for whether the app was deployed by ZEIT Now for Bitbucket.
BITBUCKET_REPO_OWNER
The Bitbucket user or team that the project belongs to.
BITBUCKET_REPO_SLUG
The slug of the Bitbucket repository that was deployed.
BITBUCKET_REPO_NAME
The name of the Bitbucket repository that the project is deployed from.
BITBUCKET_COMMIT_REF
The branch that the app was deployed using.
BITBUCKET_COMMIT_SHA
The sha of the commit the app was deployed using.
BITBUCKET_COMMIT_MESSAGE
The message accompanying the commit that the app was deployed using.
BITBUCKET_COMMIT_AUTHOR_NAME
The name of the commit author.
BITBUCKET_COMMIT_AUTHOR_URL
Bitbucket profile URL of the commit author.
Note: You can access these asĀ build environment variables also.