Skip to content

Commit 17ee264

Browse files
author
fine-agent
committed
Add Bitbucket Integration Documentation and Update Related Files
- Created a new documentation file for Bitbucket integration, mirroring the structure of the existing GitLab integration documentation. This includes sections on prerequisites, setting up a Bitbucket pipeline, creating a CM configuration file, and installing the gitStream service. Notably, highlighted that the `add-label` action is not supported in Bitbucket. - Updated the main documentation index to include a link to the new Bitbucket integration documentation for easy access. - Enhanced the FAQ section to reflect Bitbucket support, specifically updating the 'What repos are supported?' section to mention Bitbucket alongside GitHub and GitLab, with the exception of the `add-label` action. - Revised the 'How gitStream Works' documentation to include Bitbucket as a supported provider, ensuring all references to GitLab and GitHub now also mention Bitbucket. - Updated the README file to indicate Bitbucket support, ensuring the features and installation sections reflect Bitbucket as a supported provider, similar to GitHub and GitLab. - Added a default `.bitbucket-pipelines.yml` file as a template for users to set up their Bitbucket pipelines with gitStream, tailored similarly to the GitLab CI/CD setup. - Created a default `cm` file for Bitbucket, providing users with a starting point for their Continuous Merge configurations, excluding any label-related actions.
1 parent 383aca1 commit 17ee264

File tree

7 files changed

+135
-10
lines changed

7 files changed

+135
-10
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Our research shows that code reviews are [the most consistent bottleneck in the
6161

6262
## 🚀 Get Started
6363

64-
gitStream is a GitHub / GitLab app that processes automations defined in Continuous Merge (CM) automation files contained in your git repos. You can test gitStream automations on your own PRs via the [gitStream playground](https://app.gitstream.cm/playground).
64+
gitStream is a GitHub / GitLab / Bitbucket app that processes automations defined in Continuous Merge (CM) automation files contained in your git repos. You can test gitStream automations on your own PRs via the [gitStream playground](https://app.gitstream.cm/playground).
6565

6666
If you're ready to install gitStream, or want to explore its automation capabilities, [head over to the docs](https://docs.gitstream.cm). You can have your first automation up and running in as little as 2 minutes.
6767

@@ -92,4 +92,4 @@ gitStream is a free product from the team at [LinearB](https://linearb.io/?utm_s
9292
<img alt="Novu Logo" src="https://raw.githubusercontent.com/linear-b/gitstream/a5d4aca7b923e5cd70c813df06dc70de97382d8c/docs/downloads/images/LinearB-logo-dark.png" width="280"/>
9393
</picture>
9494
</a>
95-
</div>
95+
</div>

docs/bitbucket-installation.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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>

docs/faq.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ In order to support automations that either Approve or Merge PRs, GitHub API req
2323

2424
## What repos are supported?
2525

26-
Any repo in GitHub is supported. More Git providers are planned soon.
26+
gitStream supports repositories in GitHub, GitLab, and Bitbucket. Note that the `add-label` action is not supported in Bitbucket as it does not have a native labeling feature.
2727

2828
## Can I use gitStream with Merge Queues?
2929

@@ -54,4 +54,4 @@ Get a plug-in that enable modelines, popular ones are:
5454

5555
Go to our issues page and check if there are any similar issues already reported. If not, create a new issue with all the details so we can take a look.
5656

57-
Found a bug? Create a new item in the [project's issues](https://github.com/linear-b/gitstream/issues)
57+
Found a bug? Create a new item in the [project's issues](https://github.com/linear-b/gitstream/issues)

docs/how-it-works.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: How gitStream Works
33
description: Learn how gitStream automates code review workflows.
44
---
55
# How gitStream Works
6-
You can configure gitStream via one or more Continuous Merge (CM) files inside your git repository or GitHub/GitLab organization. These files end with a `.cm` extension, and they outline automations that will run for your repo's pull requests.
6+
You can configure gitStream via one or more Continuous Merge (CM) files inside your git repository or GitHub/GitLab/Bitbucket organization. These files end with a `.cm` extension, and they outline automations that will run for your repo's pull requests.
77
## Syntax Overview
88
CM files contain a combination of YAML and Jinja2 to build rules that follow an "if this, then that" approach to triggering and executing automations. This, combined with templating and gitStream-specific functions gives you a highly-flexible framework for building custom CM automations.
99

@@ -143,9 +143,9 @@ Once you have gitStream installed and have run some automations, you can view de
143143

144144
Once gitStream is installed and configured, there are several services that will interact with your repository whenever a PR is created or changed:
145145

146-
* The **git service provider API** (e.g. GitHub, Gitlab)
146+
* The **git service provider API** (e.g. GitHub, GitLab, Bitbucket)
147147
* The **gitStream service** that was installed from the git service provider marketplace.
148-
* A **gitStream CI/CD script** that is configured for the git service provider (e.g. GitHub Actions, GitLab CI/CD).
148+
* A **gitStream CI/CD script** that is configured for the git service provider (e.g. GitHub Actions, GitLab CI/CD, Bitbucket Pipelines).
149149
* A **gitStream agent** the CI/CD script triggers to execute your automation.
150150

151151
Whenever a new PR is opened or an existing PR is changed (see also [Execution Model](https://docs.gitstream.cm/execution-model/)), the following process occurs:
@@ -192,4 +192,4 @@ You can add support for `.cm` in your code editor, see [FAQ](https://docs.gitstr
192192

193193
## Is something missing?
194194

195-
If you find an issue with these docs or with gitStream itself, please search the [gitStream issues page](https://github.com/linear-b/gitstream/issues) and create an issue if one doesn't already exist for your problem.
195+
If you find an issue with these docs or with gitStream itself, please search the [gitStream issues page](https://github.com/linear-b/gitstream/issues) and create an issue if one doesn't already exist for your problem.

docs/index.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,12 @@ gitStream is a workflow automation tool that enables you to use YAML configurati
6868

6969
That's it! Now sit back and watch gitStream run automation rules on your next PR.
7070

71-
=== ":fontawesome-brands-bitbucket: BitBucket"
71+
=== ":fontawesome-brands-bitbucket: Bitbucket"
7272

73-
Coming soon
73+
1. <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.
74+
2. Connect gitStream to your Bitbucket repos by following the steps described in the [Bitbucket installation guide](bitbucket-installation.md).
75+
76+
That's it! Now sit back and watch gitStream run automation rules on your next PR.
7477

7578

7679
## Get Involved

templates/bitbucket-cm.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# -*- mode: yaml -*-
2+
manifest:
3+
version: 1.0
4+
automations:
5+
auto_approve_safe_changes:
6+
if:
7+
- {{ files | allDocs | some }}
8+
- {{ files | allTests | some }}
9+
run:
10+
- action: approve@v1
11+
args:
12+
message: "Automatically approved safe changes."
13+
14+
request_additional_review_for_large_prs:
15+
if:
16+
- {{ files | length > 10 }}
17+
run:
18+
- action: set-required-approvals@v1
19+
args:
20+
approvals: 2
21+
22+
notify_code_experts:
23+
if:
24+
- {{ files | extensions | includes('js') }}
25+
run:
26+
- action: add-comment@v1
27+
args:
28+
comment: "This PR contains JavaScript files. Please ensure a JavaScript expert reviews this PR."
29+
30+
enforce_changelog_update:
31+
if:
32+
- {{ files | match(regex=r'/src/') | some }}
33+
- {{ not (files | includes('CHANGELOG.md')) }}
34+
run:
35+
- action: request-changes@v1
36+
args:
37+
message: "Please update the CHANGELOG.md file for changes in the src directory."

templates/bitbucket-pipelines.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
image: atlassian/default-image:2
2+
3+
pipelines:
4+
default:
5+
- step:
6+
name: Run gitStream
7+
script:
8+
- pipe: docker://linear-b/gitstream-bitbucket-pipe:latest
9+
variables:
10+
GITSTREAM_CONFIG_PATH: '.cm/gitstream.cm'
11+
GITSTREAM_API_TOKEN: $GITSTREAM_API_TOKEN

0 commit comments

Comments
 (0)