Skip to content

Commit 5fc5889

Browse files
authored
Docs/#806 bitbucket api token migration (#807)
* chore: bump Node.js in .nvmrc to v20.18.1 - Fixes [email protected] engine compatibility error: Expected ">=20.18.1", found "16.18.1" * docs(bitbucket): update Bitbucket configuration for API token migration - Replace App Passwords with API Tokens as the recommended authentication method due to upcoming deprecation of App Passwords. - Add detailed instructions for creating API tokens and required scopes. - Include migration steps for existing App Password connections to API Tokens. - Update images and improve clarity in the documentation.
1 parent f706b10 commit 5fc5889

File tree

4 files changed

+92
-24
lines changed

4 files changed

+92
-24
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v16.18.1
1+
v20.18.1

docs/Configuration/BitBucket.md

Lines changed: 91 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Visit Config UI at `http://localhost:4000` and go to the `Connections` page.
88

99
## Step 1 - Add Data Connections
1010

11-
![image](https://user-images.githubusercontent.com/3294100/220118398-2d08070f-0edb-4de6-8696-9ee58b80719b.png)
11+
![Bitbucket connection form showing authentication method selection with API Token and App Password options](/img/ConfigUI/bitbucket-add-data-connections.png)
1212

1313
### Step 1.1 - Authentication
1414

@@ -20,11 +20,58 @@ Give your connection a unique name to help you identify it in the future.
2020

2121
For Bitbucket Cloud, you do not need to enter the REST API endpoint URL, which is always `https://api.bitbucket.org/2.0/`.
2222

23-
#### Username and App Password
23+
#### Authentication Method
2424

25-
Learn about [how to create a Bitbucket app password](https://support.atlassian.com/bitbucket-cloud/docs/create-an-app-password/).
25+
:::warning App Password Deprecation
26+
Bitbucket is deprecating App passwords in favor of API tokens:
2627

27-
The following permissions are required to collect data from Bitbucket repositories:
28+
- **September 9, 2025**: Creation of new App passwords will be discontinued
29+
- **June 9, 2026**: All existing App passwords will be deactivated
30+
31+
**Please use API tokens for all new connections.** Existing connections using App passwords should be migrated to API tokens before June 9, 2026.
32+
:::
33+
34+
You can choose between two authentication methods:
35+
36+
##### API Token (Recommended)
37+
38+
API tokens are the recommended authentication method for Bitbucket Cloud. Learn about [how to create a Bitbucket API token](https://support.atlassian.com/bitbucket-cloud/docs/create-an-api-token/).
39+
40+
**Steps to create an API token:**
41+
42+
1. Sign in at [https://id.atlassian.com/manage-profile/security/api-tokens](https://id.atlassian.com/manage-profile/security/api-tokens).
43+
2. Select **Create API token with scopes**.
44+
3. Give the API token a name and an expiry date (ex: 365 days), then select **Next**.
45+
4. Select **Bitbucket** as the app and select **Next**.
46+
5. Select the required scopes (see **Q2**) and select **Next**.
47+
6. Review your token and select **Create token**.
48+
7. **Copy the generated API token immediately** - it's only displayed once and can't be retrieved later.
49+
50+
For detailed instructions, refer to [Atlassian's API token documentation](https://support.atlassian.com/bitbucket-cloud/docs/create-an-api-token/).
51+
52+
**Required Scopes:**
53+
54+
The following scopes are **required** to collect data from Bitbucket repositories:
55+
56+
- `read:account` - Required to view users profiles
57+
- `read:issue:bitbucket` - View your issues
58+
- `read:pipeline:bitbucket` - View your pipelines
59+
- `read:project:bitbucket` - View your projects
60+
- `read:pullrequest:bitbucket` - View your pull requests
61+
- `read:repository:bitbucket` - View your repositories
62+
- `read:runner:bitbucket` - View your workspaces/repositories' runners
63+
- `read:user:bitbucket` - View user info (required for connection test)
64+
- `read:workspace:bitbucket` - View your workspaces
65+
66+
![Bitbucket API token scopes selection interface](/img/ConfigUI/bitbucket-api-token-scope-selection-interface.png)
67+
68+
##### App Password (Deprecated)
69+
70+
:::caution Deprecated
71+
App passwords are deprecated and should only be used for existing connections. For new connections, please use API tokens instead.
72+
:::
73+
74+
If you're using an existing App password, learn about [how to create a Bitbucket app password](https://support.atlassian.com/bitbucket-cloud/docs/create-an-app-password/).
2875

2976
- Account:Read
3077
- Workspace membership:Read
@@ -37,12 +84,10 @@ The following permissions are required to collect data from Bitbucket repositori
3784

3885
![bitbucket-app-password-permissions](/img/ConfigUI/bitbucket-app-password-permissions.jpeg)
3986

40-
4187
#### Proxy URL (Optional)
4288

4389
If you are behind a corporate firewall or VPN you may need to utilize a proxy server. Enter a valid proxy server address on your network, e.g. `http://your-proxy-server.com:1080`
4490

45-
4691
#### Fixed Rate Limit (Optional)
4792

4893
DevLake uses a dynamic rate limit to collect Bitbucket data. You can adjust the rate limit if you want to increase or lower the speed.
@@ -51,41 +96,59 @@ The maximum rate limit for different entities in Bitbucket(Cloud) [varies from 1
5196

5297
<!-- ![image](https://user-images.githubusercontent.com/3294100/220094172-9e8e9e8b-75ea-4c3e-8e5b-716320dabb64.png) -->
5398

54-
5599
#### Test and Save Connection
56100

57101
Click `Test Connection`, if the connection is successful, click `Save Connection` to add the connection.
58102

103+
#### Migrating from App Password to API Token
104+
105+
If you have an existing connection using an App password and want to migrate to an API token:
106+
107+
1. **Create an API token** in Bitbucket (see instructions above)
108+
2. **Edit your existing connection** in DevLake
109+
3. **Change the Authentication Method** from "App Password" to "API Token"
110+
4. **Enter your API token** in the token field
111+
5. **Test the connection** to verify it works
112+
6. **Save the connection**
113+
114+
Your data collection will continue without interruption, and you'll be ready for the App password deprecation in 2026.
115+
59116
### Step 1.2 - Add Data Scopes
60117

61118
Choose the Bitbucket repositories you wish to collect either by finding them in the miller column, or searching. You can only add public repositories through the search box.
62119

63120
![image](https://user-images.githubusercontent.com/14050754/224308925-449a4d3e-ed52-45e9-bb72-0d2892df374f.png)
64121

65122
### Step 1.3 - Add Scope Config (Optional)
123+
66124
#### Entities
67-
The entities of which domain you wish to collect: Usually, you don't have to modify this part. However, if you don't want to collect certain Bitbucket entities, you can unselect some entities to accelerate the collection speed.
68-
- Issue Tracking: Bitbucket issues, issue comments, etc.
69-
- Source Code Management: Bitbucket repos, refs, commits, etc.
70-
- Code Review: Bitbucket PRs, PR comments, etc.
71-
- CI/CD: Bitbucket Pipelines, Bitbucket Deployments, etc.
72-
- Cross Domain: Bitbucket users, etc.
125+
126+
The entities of which domain you wish to collect: Usually, you don't
127+
have to modify this part. However, if you don't want to collect certain
128+
Bitbucket entities, you can unselect some entities to accelerate the
129+
collection speed.
130+
131+
- Issue Tracking: Bitbucket issues, issue comments, etc.
132+
- Source Code Management: Bitbucket repos, refs, commits, etc.
133+
- Code Review: Bitbucket PRs, PR comments, etc.
134+
- CI/CD: Bitbucket Pipelines, Bitbucket Deployments, etc.
135+
- Cross Domain: Bitbucket users, etc.
73136

74137
#### Transformations
75138

76139
The transformations on the Bitbucket data you are going to collect.
77-
- The details of the transformations will be explained below.
78-
- Without adding transformation rules, you can still view the 'Bitbucket' dashboard. However, if you want to view more pre-built dashboards, finish the transformations required.
79-
- Each Bitbucket repo has at most ONE set of transformations.
80140

141+
- The details of the transformations will be explained below.
142+
- Without adding transformation rules, you can still view the 'Bitbucket' dashboard. However, if you want to view more pre-built dashboards, finish the transformations required.
143+
- Each Bitbucket repo has at most ONE set of transformations.
81144

82145
###### Issue Tracking > Issue Status Mapping
83146

84147
![image](https://user-images.githubusercontent.com/14050754/224309704-b096c256-b2cf-4107-b78c-044d06b5f23c.png)
85148

86149
The given settings transformed the Bitbucket issue statuses to the issue statuses used by DevLake, enabling you to measure metrics like the Issue Delivery Rate on the pre-built dashboards, as DevLake understands your definition of when an issue is considered as completed (status = 'DONE').
87150

88-
- TODO: The issues that are planned but have not been worked on yet
151+
- TODO: The issues that are planned but have not been worked on yet
89152
- IN-PROGRESS: The issues that are work-in-progress
90153
- DONE: The issues that are completed
91154
- OTHER: Other issues statuses that do not belong to the three statuses above
@@ -97,9 +160,10 @@ The original status will be saved in the column `original_status` of the table '
97160
DevLake will convert the issue types of 'enhancement', 'proposal', and 'task' from Bitbucket into the new issue type 'REQUIREMENT' for DevLake. In contrast, any issues classified as 'bug' in Bitbucket will be converted into the new issue type 'BUG' for DevLake. The original type will be saved in the column `original_type` of the table 'issues', and the new type will be saved in the column `type` of the same table.
98161

99162
###### CI/CD
163+
100164
The CI/CD configuration for Bitbucket is used for calculating [DORA metrics](../DORA.md).
101165

102-
By default, DevLake will identify the deployment and environment settings that are defined in the Bitbucket CI .yml file.
166+
By default, DevLake will identify the deployment and environment settings that are defined in the Bitbucket CI .yml file.
103167

104168
![image](https://user-images.githubusercontent.com/14050754/224311429-31304867-8cdd-476b-8675-e4acbc17f552.png)
105169

@@ -118,6 +182,7 @@ If you have not defined these settings in the .yml file, please select 'Detect D
118182
- Production: A pipeline step with a name that matches the given RegEx will be recognized as a DevLake cicd_task in the production environment.
119183

120184
###### Introduction to Bitbucket CI entities
185+
121186
Bitbucket has several key CI entities: `pipelines`, `pipeline steps`, and `deployments`. A Bitbucket pipeline contains several pipeline steps. Each pipeline step defined with a deployment key can be mapped to a Bitbucket deployment.
122187

123188
Each Bitbucket pipeline is converted to a cicd_pipeline in DevLake's domain layer schema and each Bitbucket pipeline step is converted to a cicd_task in DevLake's domain layer.
@@ -131,40 +196,43 @@ If a pipeline step defines `deployment` with a value (usually indicating the env
131196

132197
- Tags Limit: DevLake compares the last N pairs of tags to get the "commit diff', "issue diff" between tags. N defaults to 10.
133198

134-
- commit diff: new commits for a tag relative to the previous one
135-
- issue diff: issues solved by the new commits for a tag relative to the previous one
199+
- commit diff: new commits for a tag relative to the previous one
200+
- issue diff: issues solved by the new commits for a tag relative to the previous one
136201

137202
- Tags Pattern: Only tags that meet the given Regular Expression will be counted.
138203

139204
- Tags Order: Only "reverse semver" order is supported for now.
140205

141206
Please click `Save` to save the transformation rules for the repo. In the data scope list, click `Next Step` to continue configuring.
142207

143-
144-
145208
## Step 2 - Collect Data in a Project
209+
146210
### Step 2.1 - Create a Project
211+
147212
Collecting Bitbucket data requires creating a project first. You can visit the Project page from the side menu and create a new project by following the instructions on the user interface.
148213

149214
![create-a-project](images/create-a-project.png)
150215

151216
### Step 2.2 - Add a Bitbucket Connection
217+
152218
You can add a previously configured Bitbucket connection to the project and select the boards for which you wish to collect the data for.
153219
Please note: if you don't see the repositories you are looking for, please check if you have added them to the connection first.
154220

155221
![add-a-connection](images/add-a-connection-project.png)
156222

157223
### Step 2.3 - Set the Sync Policy
224+
158225
There are three settings for Sync Policy:
226+
159227
- Data Time Range: You can select the time range of the data you wish to collect. The default is set to the past six months.
160228
- Sync Frequency: You can choose how often you would like to sync your data in this step by selecting a sync frequency option or enter a cron code to specify your preferred schedule.
161229
- Skip Failed Tasks: sometime a few tasks may fail in a long pipeline; you can choose to skip them to avoid spending more time in running the pipeline all over again.
162230

163231
![sync-policy](images/sync-policy.png)
164232

165233
### Step 2.4 - Start Data Collection
166-
Click on "Collect Data" to start collecting data for the whole project. You can check the status in the Status tab on the same page.
167234

235+
Click on "Collect Data" to start collecting data for the whole project. You can check the status in the Status tab on the same page.
168236

169237
## Troubleshooting
170238

112 KB
Loading
186 KB
Loading

0 commit comments

Comments
 (0)