|
| 1 | +--- |
| 2 | +title: How to Setup gitStream with Bitbucket |
| 3 | +description: Install gitStream to your Bitbucket workspace. |
| 4 | +--- |
| 5 | +# How to Setup gitStream with Bitbucket |
| 6 | + |
| 7 | +!!! info "Prerequisites" |
| 8 | + |
| 9 | + 1. Bitbucket Cloud account |
| 10 | + 2. Bitbucket Pipelines enabled |
| 11 | + 3. <a href="https://app.linearb.io/login" target="_blank">Login</a>, or <a href="https://app.linearb.io/sign-up" target="_blank">create a free account</a> on the LinearB app, and follow the steps to connect gitStream using a Bitbucket integration. |
| 12 | + |
| 13 | +Bitbucket Installation Overview |
| 14 | + |
| 15 | +1. Designate a gitStream user account. |
| 16 | +2. Create a CM configuration file. |
| 17 | +3. Create a Bitbucket pipeline. |
| 18 | +4. Install the gitStream service. |
| 19 | + |
| 20 | +## Designate a gitStream User Account |
| 21 | + |
| 22 | +gitStream automation rules are executed on behalf of the user account configured when you install the gitStream service. This account must have the necessary permissions to the relevant repositories. |
| 23 | + |
| 24 | +We recommend creating a dedicated service account to control access to individual repositories easily. You can also use your professional or personal Bitbucket account for this, which would result in all automations being executed under that account. |
| 25 | + |
| 26 | +!!! tip "Use this account when you integrate gitStream" |
| 27 | + Make sure to use this account when authorizing Bitbucket in LinearB. |
| 28 | + |
| 29 | +## Create a CM Configuration File |
| 30 | + |
| 31 | +Create a `gitstream.cm` rules file in the root directory of your repository's default branch (usually `master` or `main`). This file will contain a YAML configuration that determines the workflows that run on your repositories. You can name the CM file anything you want as long as it ends in `.cm`. |
| 32 | + |
| 33 | +!!! info "Configuration files go in the repo's root directory." |
| 34 | + Your `.cm` files should be placed in the repository's root directory. |
| 35 | + |
| 36 | +!!! example "Example Configuration" |
| 37 | + ```yaml |
| 38 | + --8<-- "docs/downloads/gitstream.cm" |
| 39 | + ``` |
| 40 | + |
| 41 | +## Create a Bitbucket Pipeline |
| 42 | + |
| 43 | +Once your gitStream configuration file is set up, you need a Bitbucket Pipelines configuration file to trigger gitStream automations. Create a `.bitbucket-pipelines.yml` file in your repository's default branch (usually `master` or `main`) and add the following configuration: |
| 44 | + |
| 45 | +```yaml |
| 46 | +--8<-- "docs/downloads/bitbucket-pipelines.yml" |
| 47 | +``` |
| 48 | + |
| 49 | +!!! warning "Note" |
| 50 | + The `add-label` action is not supported in Bitbucket as Bitbucket does not have a native labeling feature. |
| 51 | + |
| 52 | +## Install the gitStream Service |
| 53 | + |
| 54 | +To complete the setup, install the gitStream service in your Bitbucket workspace. Follow the instructions provided in the LinearB app to connect your Bitbucket account and repositories to gitStream. |
| 55 | + |
| 56 | +## Next Step |
| 57 | +If you successfully complete these instructions, gitStream will now automate your code review workflows in Bitbucket. |
| 58 | + |
| 59 | +!!! tip "How gitStream Works" |
| 60 | + Read our guide, [How gitStream Works](/how-it-works/), for a deeper understanding of gitStream's capabilities and how to leverage them fully. |
| 61 | + |
| 62 | +## Additional Resources |
| 63 | + |
| 64 | +### Required Bitbucket Permissions |
| 65 | + |
| 66 | +The required permissions are: |
| 67 | + |
| 68 | +| Permissions | Reason | |
| 69 | +| ----------------- | -------------------------------------------------------------------------------------------- | |
| 70 | +| Read/Write API | To get notified on PR changes and allow gitStream to approve PRs once all conditions are met | |
| 71 | +| Read repository | To read and check rules over the code changes on monitored repositories | |
| 72 | +| Read user profile | Used to identify users | |
| 73 | + |
| 74 | +</markdown> |
0 commit comments