---
title: Bitbucket Pipelines
description: Monitoring of Bitbucket Cloud Pipelines in Pipedash, with branch and custom pipeline triggers, run history, run cancel and step logs.
---

The Bitbucket Pipelines plugin (`bitbucket`) monitors the latest pipeline run of each selected Bitbucket Cloud repository. It loads run history, starts pipelines on a branch and stops running pipelines. It also shows step logs inside Pipedash.

## Requirements

Authentication is HTTP Basic. Pipedash joins the Atlassian account email and a Bitbucket API token and confirms them with a request for the current user.

| Permission | Required | What it unlocks |
|---|---|---|
| `read:user:bitbucket` | Yes | Reading the current user, used to confirm credentials |
| `read:repository:bitbucket` | Yes | Repository information and source code access |
| `read:workspace:bitbucket` | Yes | Workspace and workspace permission data |
| `read:pipeline:bitbucket` | Yes | Pipeline runs, steps, logs and status |
| `write:pipeline:bitbucket` | No | Triggering and canceling pipeline runs |

Pipedash groups these into three features. View Pipelines needs the three read permissions on repositories, workspaces and pipelines. Trigger Pipelines and Cancel Pipelines each need `write:pipeline:bitbucket`. Pipedash does not test the permissions against Bitbucket and reports all of them as granted. A token without a permission fails when the request needs it.

## Configuration

<Screenshot src="provider-bitbucket-pipelines" variant="dialog" alt="Add provider dialog with Bitbucket Pipelines credential fields" caption="Bitbucket Pipelines asks for the Atlassian email and an API token." />

| Key | Type | Required | Default | Description |
|---|---|---|---|---|
| `email` | Text | Yes | None | The Atlassian account email, found in Bitbucket personal settings under Email. |
| `api_token` | Password | Yes | None | Bitbucket API token with Repository:Read, Workspace:Read and Pipelines:Read/Write scopes. The form labels it "API Token". |

The config table of the TOML file also takes `selected_items`, a comma-separated list of repository full names in the form `workspace/repo`. Matching is case-sensitive.

## Base URL

The plugin always uses the endpoint `https://api.bitbucket.org/2.0`. There is no `base_url` field, so the plugin works with Bitbucket Cloud only.

## Status page

Pipedash reads the Bitbucket status page at bitbucket.status.atlassian.com. It has no `status_page_url` field. The [Provider health](/docs/features/provider-health) page covers how Pipedash uses status pages.

## Pipeline discovery

The picker asks for an organization first. Organizations are Bitbucket workspaces, listed by name with the workspace slug as description. Selecting a workspace lists its repositories. Search matches repository name and ID, ignoring case. Pipedash filters each loaded repository page. A page can have no matches while later pages still contain matching repositories. The reported total counts repositories before the search filter.

Pipedash shows the latest pipeline run of each repository in `selected_items`. Without that key, it shows every repository where the account is a member. A permanent error on one repository skips that repository. A network error, a rate limit or an unavailable service fails the whole refresh.

Workspace discovery reads up to 10 pages of 100 workspaces. A workspace beyond that limit does not appear in the organization picker.

Monitoring reads member repositories in pages of 100, up to 50 pages. Pipedash applies `selected_items` after that scan. A selected repository outside those pages does not appear.

### Repositories without CI

Repositories with a `bitbucket-pipelines.yml` file and no runs show as `pending`. Repositories with no runs and no such file at `HEAD` do not appear. If the file lookup fails, the repository stays visible.

Saving a provider in the app or through the REST API drops selected repositories that have no runs and no `bitbucket-pipelines.yml`. Repositories with the file stay, and so do repositories whose lookup fails. If every selected repository lacks CI, the save fails with "None of the selected repositories has a CI file or a pipeline run yet". Providers that come from the TOML file or an import keep their `selected_items` as written.

## Run history

Run history follows the Bitbucket `next` link page by page, with up to 100 runs per page, newest first. It stops when the history view has enough runs or Bitbucket returns no next link. Older pages can load beyond 1000 runs.

Run details, the Logs tab and cancel search the history page by page until the build number appears, with no page limit. A run beyond the newest 1000 still opens, and an old run takes one request per page of 100. A build number that does not exist returns the error "Pipeline run #N not found for workspace/repo".

## Trigger parameters

| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| `ref` | String | Yes | `main` | Branch name to run the pipeline on. The form labels it "Branch". |
| `custom_pipeline` | String | No | None | Name of a custom pipeline to run. The form labels it "Custom Pipeline". |

## Cancel

Pipedash stops the pipeline through the Bitbucket API. It refuses completed pipelines and pipelines in the `PAUSED` or `HALTED` state. It also refuses pipelines with a step that waits for manual approval. Those pipelines cancel only in the Bitbucket UI.

## Run logs

The Logs tab of the run details lists the steps of the pipeline, each with its status and times. A step without a name shows as "Step N". Pipedash reads the steps with `GET /repositories/{workspace}/{repo}/pipelines/{pipeline}/steps`, 100 per page, up to 10 pages. It downloads the log of one step with `GET .../steps/{step}/log` and streams it to disk. A download stops with an error when no data arrives for 60 seconds, and after 15 minutes in total. Each log read first looks up the pipeline by its build number, as described under Run history.

Bitbucket logs stream while a step runs. With the dialog open, Pipedash reads the log of a running step about every 2 seconds and asks Bitbucket only for the bytes it has not read yet. A resumed request sends `Range: bytes=<offset>-`. If Bitbucket ignores the range and returns the whole log, Pipedash replaces the cached text. An inconsistent range response also causes a full reload. A range response that confirms the log has not grown adds no text. It reads the step list again every 5 seconds while the pipeline is unfinished. A step that is pending shows "Logs appear when this job finishes" and opens by itself. A step that never ran, with the result `NOT_RUN`, shows as skipped and has no log. When Bitbucket answers `404` or `410` for a step log, the tab shows "The provider no longer has this log. It may have expired."

Bitbucket logs have no sections or timestamps. A line that starts with `+ ` followed by a command shows as a command. Pipedash flags error lines itself, for example a line that starts with `ERROR:` or `fatal:`. The [Run logs](/docs/features/run-logs) page covers the viewer.

## TOML example

The API token uses the `api_token` key in the config table.

```toml
[providers.bitbucket-team]
name = "Bitbucket Team"
type = "bitbucket"
refresh_interval = 30

[providers.bitbucket-team.config]
email = "${BITBUCKET_EMAIL}"
api_token = "${BITBUCKET_API_TOKEN}"
selected_items = "myworkspace/api,myworkspace/web"
```

## Status mapping

Pipedash maps the pipeline state and, for completed pipelines, the result.

| Pipedash status | Bitbucket state |
|---|---|
| `success` | `COMPLETED` with result `SUCCESSFUL` |
| `failed` | `COMPLETED` with result `FAILED` or `ERROR`, or with an unknown result |
| `running` | `PARSING`, or `IN_PROGRESS` when the stage is not `PAUSED` |
| `pending` | `PENDING`, `READY`, `PAUSED`, `HALTED`, `IN_PROGRESS` with stage `PAUSED`, and any other state |
| `cancelled` | `COMPLETED` with result `STOPPED` or `EXPIRED` |
| `skipped` | `COMPLETED` with result `NOT_RUN` |
