Repositories, branches and tags, commits, files, pull requests, comments, reviewers,
build statuses and Pipelines on Bitbucket Data Center / Server (REST API 1.0:
/rest/api/1.0, plus /rest/build-status/1.0 and /rest/default-reviewers/1.0) and
Bitbucket Cloud (https://api.bitbucket.org/2.0, REST API 2.0). One command tree and
one set of MCP tools serve both; each call goes to the deployment of the connection it
resolves. Verification level: unit for both. Data Center’s behavior is the one the
command contract records; Cloud was built from Atlassian’s API documentation and has
never run against a live workspace.
Supported versions: The oldest Bitbucket Data Center version toil supports hasn’t been established. toil
calls REST API 1.0 (/rest/api/1.0, /rest/build-status/1.0 and /rest/default-reviewers/1.0) with an HTTP access token
sent as a Bearer header. No release has been verified yet. Bitbucket Cloud (a connection with
deployment cloud) is always current: toil calls REST API 2.0 (https://api.bitbucket.org/2.0)
with an Atlassian API token sent as Basic auth with the account email, or a workspace,
project or repository access token sent as Bearer. Nothing has been run against a live
workspace yet.
Data Center and Cloud
A connection says which one it is with deployment: server for Data Center (the
default) or cloud. The two keep separate API code and each returns its own API’s
shape, unchanged; meta.context.connection.deployment says which one ran. What differs:
| Data Center | Cloud | |
|---|---|---|
| Credential | HTTP access token (pat), Authorization: Bearer | email + apiToken (Basic auth), or an accessToken (Bearer) |
| Where a call acts | --project <key> and --repo <slug> | --ws <slug> (a workspace) and --repo <slug> |
| People | usernames (--reviewers jdoe,asmith) | account ids (--reviewers 557058:abc12345-…) or {uuid}s |
| Paging | nextPageStart | next links |
pr diff | <id> required; data.diff is Bitbucket’s JSON diff structure as a string | [id] or --spec; data.diff is unified diff text |
| Pull request version | locks writes to the version it read | none |
| Only here | check-dossier, pr create-many, pr add-reviewer | repo list, repo get, branch, tag, commit list, commit get, file, pipeline, api |
A call the connection’s deployment can’t serve fails before any request with
UNSUPPORTED, saying which deployment and what to do: bitbucket pipeline list or --ws on
a Data Center connection, bitbucket pr create-many or --project on a Cloud one. The error
names the connections you have that can run it.
--project and --ws are different ideas, so both stay and each is refused on the other
deployment: a Data Center project is the container of repositories, a Cloud workspace is the
account that owns them, and Cloud has projects too, inside a workspace. The one place a
Cloud call takes --project is repo create, to put the new repository in a project of the
workspace. --reviewers is one flag whose value is a username on Data Center and an account
id on Cloud. pr needs-work is one command: Cloud calls it requesting changes, and
pr request-changes is the same command on either deployment.
Credential
Data Center: a Bitbucket HTTP access token: in Bitbucket, your profile picture →
Manage account → HTTP access tokens → Create token. Give it repository write (or admin, for
repo create) permission if you’ll use the write commands. toil sends it as
Authorization: Bearer <token>. There is no username, password or browser login.
Cloud: one of two, each generated once in Atlassian’s UI. A connection holds exactly one;
setting both is refused with CONFIG_INVALID.
- An Atlassian API token with Bitbucket scopes, plus that account’s email
address. Create it at https://id.atlassian.com/manage-profile/security/api-tokens
→ Create API token with scopes → Bitbucket. toil sends
Authorization: Basic base64(<email>:<apiToken>), as Atlassian documents. The token acts as you. Scopes:- reads:
read:repository:bitbucket,read:pullrequest:bitbucketandread:pipeline:bitbucket, plusread:user:bitbucketfortoil connections test - writes:
write:pullrequest:bitbucket(pull requests and comments),write:repository:bitbucket(branch create,tag create) andadmin:repository:bitbucket(repo create)
- reads:
- A workspace, project or repository access token, from Repository settings,
Project settings or Workspace settings → Access tokens. toil sends
Authorization: Bearer <accessToken>. The token acts as itself, named after the token, on only what it was made for. Scopes:repository,pullrequestandpipelineto read;pullrequest:writeandrepository:writeto write.toil connections testchecks it against the connection’sworkspaceandrepo, and can’t check one with neither.
App passwords no longer work on Cloud and toil doesn’t take them. A 401, 403 or 410
from Bitbucket Cloud is AUTH, and its fix names the credential to create and the
scopes it needs. There is no OAuth app, Connect app or browser login.
Configuration
| Key | Env var | Required | Meaning |
|---|---|---|---|
baseUrl | TOIL_BITBUCKET_BASE_URL | yes | Data Center: the server root, e.g. https://bitbucket.imagile.dev (keep any context path). Cloud: the REST API root, https://api.bitbucket.org/2.0 |
deployment | TOIL_BITBUCKET_DEPLOYMENT | no | server (Data Center, the default) or cloud |
pat | TOIL_BITBUCKET_PAT | Data Center | HTTP access token (a secret) |
email | TOIL_BITBUCKET_EMAIL | Cloud, with apiToken | Email address of the Atlassian account the API token belongs to |
apiToken | TOIL_BITBUCKET_API_TOKEN | Cloud, one of the two | Atlassian API token with Bitbucket scopes (a secret) |
accessToken | TOIL_BITBUCKET_ACCESS_TOKEN | Cloud, one of the two | Workspace, project or repository access token (a secret) |
project | TOIL_BITBUCKET_PROJECT | no | Default project key, when --project isn’t given (on Cloud, only repo create reads it) |
workspace | TOIL_BITBUCKET_WORKSPACE | no | Cloud: default workspace slug, when --ws isn’t given |
repo | TOIL_BITBUCKET_REPO | no | Default repository slug, when --repo isn’t given |
targetBranch | TOIL_BITBUCKET_TARGET_BRANCH | no | Data Center: default target branch for pr create (main when unset) |
writes | TOIL_BITBUCKET_WRITES | no | true lets write commands run (with --allow-write) |
CI fallback: in Bitbucket Pipelines, a Cloud default connection takes workspace from
BITBUCKET_WORKSPACE and repo from BITBUCKET_REPO_SLUG, which Pipelines sets on
every step, when TOIL_BITBUCKET_WORKSPACE and TOIL_BITBUCKET_REPO aren’t set. A Data Center
default ignores both. Pipelines sets no API credential, so the token is still yours to supply as a
secured variable.
Environment variables (CI, or a one-off shell):
# Data Center
export TOIL_BITBUCKET_BASE_URL=https://bitbucket.imagile.dev
export TOIL_BITBUCKET_PAT=<your HTTP access token>
# Cloud
export TOIL_BITBUCKET_DEPLOYMENT=cloud
export TOIL_BITBUCKET_BASE_URL=https://api.bitbucket.org/2.0
export TOIL_BITBUCKET_EMAIL=you@example.com
export TOIL_BITBUCKET_API_TOKEN=<your API token>
# or, instead of the email and API token:
export TOIL_BITBUCKET_ACCESS_TOKEN=<your access token>
The Cloud variables were TOIL_BITBUCKET_CLOUD_* before config version 3; those are
refused now, with the name to use instead (see Moving from bitbucket-cloud).
Or ~/.toil/config.json. defaults.bitbucket reaches every Bitbucket connection, Cloud ones
too, so a Data Center project, repo and targetBranch go on the Data Center connection:
{
"version": 3,
"connections": {
"corp-bitbucket": { "area": "bitbucket", "baseUrl": "https://bitbucket.imagile.dev", "project": "PROJ", "repo": "imagile-api", "targetBranch": "develop", "writes": true },
"imagile-bbc": { "area": "bitbucket", "deployment": "cloud", "baseUrl": "https://api.bitbucket.org/2.0", "email": "you@example.com", "writes": true }
},
"defaults": { "bitbucket": { "connection": "corp-bitbucket" } }
}
No token ever goes in this file; a plaintext one there is refused with
CONFIG_INVALID. Run toil connections add corp-bitbucket --area bitbucket (or
toil connections login corp-bitbucket for an existing connection) to keep it in the
OS credential store, or set the env var. Env vars always win over the file. Another Bitbucket
is another connection, chosen per call with --connection imagile-bbc, or configured from env
with TOIL_CONN_IMAGILE_BBC_AREA=bitbucket, TOIL_CONN_IMAGILE_BBC_DEPLOYMENT=cloud plus
TOIL_CONN_IMAGILE_BBC_BASE_URL and its credential. A defaults.bitbucket setting reaches the
connections of both deployments, so a default that only one deployment reads
(targetBranch, workspace) belongs on that deployment’s connection.
Where a command acts
Data Center: --project <key> and --repo <slug> are group flags, accepted before or
after the command (toil bitbucket --project PROJ pr list, or
toil bitbucket pr create --project ~jdoe --repo scratch ... for a personal
repository). Without them, toil reads them from the first of the workspace’s remotes
on the connection’s host, of any name, trying origin first (git@<host>:PROJ/repo.git or
https://<host>/scm/PROJ/repo.git; ssh:// URLs and HTTPS with a user name aren’t
recognised), so a fork whose Bitbucket remote is upstream works too, then the connection’s
project and repo settings. repo create and pr create-many need
only a project; every other command needs both, and fails with “Could not determine
Bitbucket project/repo” when either is missing. meta.context says where each came
from.
Cloud: every command takes --ws <slug> and --repo <slug>, before or after the command
name: toil bitbucket --ws imagile --repo toil pr list, with the connection’s workspace
and repo behind them. It’s --ws, not --workspace, because toil’s own --workspace is
the folder commands may read and write files in. The git remote is not read for a Cloud
connection. repo list and repo create need only the workspace; everything else needs
both. Over MCP they’re the workspace and repo fields.
Data Center pull request and comment ids are read as whole numbers from the start of the
text: 12abc is 12, and abc is sent as NaN. Cloud ids must be whole numbers.
Commands
Every command is toil bitbucket <resource> <action> [ids...] [--flags], ids are positional,
and its MCP tool is the path with underscores (bitbucket_pr_get,
bitbucket_pr_comment_inline). Every command also takes --connection <name>. Write
commands (marked ✎) need writes: true on the connection and --allow-write. pr delete-comment is CLI only: it is never an MCP tool. The last column says who has it, and
a flag listed for one deployment is refused on the other.
| Command | Arguments and flags | Deployments and what it returns |
|---|---|---|
repo list | --filter --limit --cursor | Cloud: repositories in the workspace |
repo get | Cloud: the repository | |
repo create ✎ | --name --description --public | Data Center: a repository in the project. Cloud: a private one in the workspace (--public makes it public; --project puts it in a project of the workspace) |
repo default-reviewers | Data Center: the default-reviewer conditions. Cloud: the repository’s default reviewers | |
branch list | --filter --limit --cursor | Cloud: branches, each with its target commit |
branch create ✎ | --name --commit | Cloud: the created branch |
tag list | --filter --limit --cursor | Cloud: tags, each with its target commit |
tag create ✎ | --name --commit --message | Cloud: the created annotated tag |
commit list | --branch --path --limit --cursor | Cloud: commits, newest first (100 unless --limit says otherwise) |
commit get | <commit> | Cloud: the commit |
commit status | <commit> | Build statuses of the commit. Data Center needs a project and repo it doesn’t use |
file get | <path> --ref | Cloud: { path, commit, content } |
file list | [path] --ref | Cloud: the folder’s files and subfolders (the repository root without a path) |
pr list | --state --author --reviewer --created-after --created-before --query --updated-since --limit --cursor | Pull requests in one state (OPEN unless --state says otherwise). --author, --reviewer and the dates are Data Center’s, --query is Cloud’s |
pr get | <id> --include | The pull request, plus included lists on request |
pr create ✎ | --title --source --target --description --reviewers --close-source-branch --draft | The created pull request. --close-source-branch and --draft are Cloud’s |
pr create-many ✎ | --from --to --repos --title --description --reviewers | Data Center: one pull request per repository |
pr update ✎ | <id> --title --description --reviewers --target | The updated pull request. --target is Cloud’s |
pr merge ✎ | <id> --strategy --message --delete-branch | The merged pull request. --message is Cloud’s, and a queued merge there is { pending, taskStatus } |
pr decline ✎ | <id> | The declined pull request |
pr current | The open pull request from the current git branch, or null (toil git current-pr is the same command) | |
pr comments | <id> --no-with-replies --inline-only --general-only | Comments, oldest first, replies included |
pr comment ✎ | <id> --body | The comment |
pr comment-inline ✎ | <id> --file --line --body --line-type | The comment |
pr reply ✎ | <id> <comment-id> --body | The reply |
pr resolve ✎ | <id> <comment-id> --comment-version | Data Center: { resolved }, at --comment-version. Cloud: the resolution record |
pr delete-comment ✎ | <id> <comment-id> --comment-version | { deleted }, at --comment-version on Data Center |
pr diff | [id] --spec --file --context-lines | { diff }. Data Center needs <id>; --spec is Cloud’s |
pr files | <id> | Paths the pull request changes |
pr approve ✎ / pr unapprove ✎ | <id> | The participant record (Cloud’s unapprove returns { unapproved }) |
pr needs-work ✎ | <id> | The participant record; also pr request-changes |
pr reviewers | <id> | Reviewers, with their status (Data Center) or approved and state (Cloud) |
pr add-reviewer ✎ | <id> --user | Data Center: adds the user as a reviewer. On Cloud, pr update --reviewers takes the whole list |
pr builds | <id> | Build statuses on the pull request |
pipeline list | --branch --limit --cursor | Cloud: pipeline runs, newest first (100 unless --limit says otherwise) |
pipeline get | <pipeline> | Cloud: the pipeline run |
pipeline steps | <pipeline> | Cloud: its steps |
pipeline logs | <pipeline> <step> | Cloud: { log }, the step’s log text |
api | <method> <path> --query --body-file --content-type | Cloud: any REST API 2.0 endpoint |
check-dossier | Data Center: checks the call’s dossier (see below) |
# Data Center
toil bitbucket --project PROJ --repo imagile-api pr list --state OPEN --author jdoe
toil bitbucket pr get 42 --include reviews,checks
toil bitbucket pr list --updated-since 2026-10-01 --limit 20
toil bitbucket pr create --title "Add retries" --source feature/retries --allow-write
toil bitbucket pr comments 42 --no-with-replies
# Cloud
toil bitbucket --ws imagile --repo toil pr list --state ALL --limit 20 --connection imagile-bbc
toil bitbucket --ws imagile --repo toil file get src/retry.ts --ref feature/retries --connection imagile-bbc
toil bitbucket --ws imagile --repo toil pr diff 42 --file src/retry.ts --connection imagile-bbc
toil bitbucket --ws imagile --repo toil pipeline list --branch main --limit 5 --connection imagile-bbc
Pull requests on Data Center
pr listreturns every page unless--limitsays otherwise.--stateisOPEN(default),MERGED,DECLINEDorALL;--authorand--reviewertake usernames;--created-after(inclusive),--created-before(exclusive) and--updated-since(inclusive, on the last update) take ISO 8601 dates. Bitbucket has no date filter, so toil applies them to each page as it reads it. A date alone is UTC midnight; a date-time without a zone is local time. With--limit Nit returns at most N of the pull requests that pass, andmeta.page.nextCursorresumes: pass it back as--cursor, with--limit.pr get --include reviews,checks,commits,filesadds anincludedobject holding only the lists named, each as Bitbucket returns it, every page read:reviews(theAPPROVED,UNAPPROVEDandREVIEWEDactivities;REVIEWEDis needs-work),checks(the build statusespr buildsreturns, which is one page),commits, andfiles(the changes, as Bitbucket sends them). Each list costs more requests; an unknown name is refused before any is sent.pr createwithout--reviewersapplies Bitbucket’s default-reviewer conditions. The target is--target, then the connection’stargetBranch, thenmain.pr create-manypromotes--fromto--toin every repository in--repos a,b, one at a time, skipping repositories with nothing to promote. Each one reportscreated,nothing_to_promoteorerror, with counts insummary. The command succeeds even when every repository failed, so checksummary.error; that case also carries aBITBUCKET_ALL_FAILEDwarning inmeta.warnings. Its time limit is 30 minutes rather than 2, so a long batch still reports every repository. The title defaults toPromote <from> to <to>.pr updatechanges--title,--descriptionor--reviewers(which replaces the whole list). Anything not given is resent as it is now, so nothing is cleared.pr mergemerges at the current version.--strategyis sent as Bitbucket’s merge strategy id (squash,ff; Bitbucket calls a merge commitno-ff).--delete-branchsets Bitbucket’sautoSubjectand doesn’t delete the branch; the merge still succeeds, with aBITBUCKET_BRANCH_NOT_DELETEDwarning.pr currentreads the branch from.git(no git needed). With no Bitbucket connection, or one missing itspat, it succeeds with{ "message": "Requires Bitbucket config. ..." }(the latter with aCONFIG_INCOMPLETEwarning).pr commentsflattens replies in, withparentId.--no-with-repliesreturns top-level comments only (replies stay nested undercomments).pr comment-inlineanchors the line to the new version of the file.pr resolvetakes the thread’s root comment and--comment-version(default0;pr commentsreports each comment’sversion).pr diff <id>:data.diffis Bitbucket’s JSON diff structure as a string, not unified diff text.pr filesis one request of up to 1000 changes; an entry that Bitbucket returns as a path object comes back as that object in a JSON string.pr needs-workmarks needs-work as the token’s user, adding them as a reviewer first when they aren’t one. That addition stays if the status change then fails.pr add-revieweradds--user.pr buildsandcommit statusreturn one page of statuses, at Bitbucket’s default size (25), for the newest commit.
Pull requests on Cloud
--reviewers takes a comma-separated list of Atlassian account ids (557058:abc12345-…),
or {uuid}s in braces, as pr get and repo default-reviewers show them; Bitbucket Cloud has
no usernames in its API. pr list --query filters with Bitbucket’s query language, for example
--query 'author.account_id = "557058:abc12345"' or
--query 'source.branch.name = "feature/retries"', where Data Center has --author and
--reviewer. --updated-since takes an ISO 8601 date (midnight UTC) or a date and time with a
zone, and goes to Bitbucket as updated_on >= <instant> in the same query, after any --query
in parentheses.
pr get <id> --include reviews,checks,commits,files adds an included object holding only the
lists named, each as Bitbucket returns it with every page read: reviews (the activity entries
holding an approval or changes_requested), checks (the build statuses pr builds
returns), commits, and files (the diffstat entries, with lines_added and lines_removed
for each file). Each list costs more requests; an unknown name is refused before any is sent.
Paging on Cloud
Lists follow Bitbucket’s next link, 100 items a request, and toil follows a link only when it’s
on the connection’s own host and names the same list. Without --limit, repo list,
branch list, tag list and pr list read every page; commit list and pipeline list
return the newest 100, since a history has no end worth reaching. With --limit N they return
at most N, and meta.page.nextCursor resumes: pass it back as --cursor (with --limit on the
lists that read every page). Every other list is read in full. Paging stops after 1,000
requests with an error naming the list.
Any endpoint on Cloud: bitbucket api
When no command above covers a Cloud endpoint, bitbucket api calls it directly. It sends the
connection’s own credential, the same way every other bitbucket command does, to a path
under the connection’s baseUrl (so the path starts after /2.0). On a Data Center connection
it fails with UNSUPPORTED:
toil bitbucket api GET repositories/imagile/toil --connection imagile-bbc
toil bitbucket api GET repositories/imagile/toil/refs/branches --query 'q=name ~ "release"' --query pagelen=10 --connection imagile-bbc
toil bitbucket api GET repositories/imagile/toil/pullrequests/42/merge/task-status/abc12345 --connection imagile-bbc
toil bitbucket api POST repositories/imagile/toil/pullrequests/42/comments --body-file comment.json --allow-write --connection imagile-bbc
- The path is relative to
baseUrl, with or without a leading/(in Git Bash on Windows, leave it off: the shell rewrites/repositories/...into a file path, which is refused). A full URL, a scheme,//host, a leading backslash or a./..segment is refused withINVALID_INPUTbefore anything is sent, so the token never leaves the connection’s host. - The method decides the gate.
GETandHEADare reads.POST,PUT,PATCHandDELETEare writes: they needwrites: trueon the connection and--allow-write.DELETEworks only on the CLI: over MCP,bitbucket_apirefuses it withINVALID_INPUT. --query key=valueadds a query parameter; repeat it for more, or to repeat a key.--body-file <path>sends that file (inside the workspace, or-for stdin) as the body, asapplication/jsonunless--content-typesays otherwise.- Output: a JSON body is
data, parsed. A text body (text/*, XML, or no content type) isdataas text. Any other body is binary:datais its bytes as base64, with anAPI_BINARYwarning. Text and binary are capped at 1 MB, with anAPI_TRUNCATEDwarning when the body was longer. An empty body (a204, aHEAD) isnull.meta.responseis{ status, contentType }. Errors use the usual codes (AUTH,NOT_FOUND,HTTP,NETWORK) with Bitbucket’s own message; a410here isAUTH, as it is on every other command. A body labelled JSON that doesn’t parse comes back as text, with anAPI_NOT_JSONwarning. - Over MCP it’s the
bitbucket_apitool, withmethod,path,query(an array ofkey=valuestrings),bodyFile,contentTypeandallowWrite.
Prefer a wrapped command when one exists: it knows the endpoint’s paging and quirks,
and bitbucket api doesn’t.
Notes on Cloud
file getandfile listread at--ref, a branch, tag or commit hash (the repository’s main branch without it). A branch or tag is first resolved to its newest commit, whichdata.commitreports, so a branch name with a/works. A file comes back as text; read a folder withfile list, notfile get.pr diff <id>andpr filesread the pull request first and diff its source commit against its destination withtopic=true, the three-dot diff Bitbucket shows on the pull request, so--fileand--context-linesapply.pr diff --spectakes one commit (against its first parent) ora..b. Pass exactly one of an id and--spec. A pull request from a fork isn’t diffed this way: use--specin the fork, orapi.pr updatereads the pull request first and sends back its current title, description and reviewers for anything not given, so nothing is cleared by omission.--reviewersreplaces the whole list.pr merge --delete-branchsendsclose_source_branch, which deletes the source branch after the merge.--strategyis one ofmerge_commit,squash,fast_forward,squash_fast_forward,rebase_fast_forwardorrebase_merge; left out, the repository’s default applies. When Bitbucket queues the merge or takes longer than it waits (202),datais{ pending: true, taskStatus }with aBITBUCKET_CLOUD_MERGE_PENDINGwarning: readtaskStatuswithbitbucket api GETuntil itstask_statusisSUCCESS.pr needs-work(pr request-changes) requests changes;pr unapprovewithdraws an approval. Adding a single reviewer ispr update --reviewerswith the whole list.pr comment-inlineanchorsADDEDandCONTEXTlines in the new file (to) andREMOVEDlines in the old one (from).pr resolvetakes the thread’s root comment; one that’s already resolved is an HTTP409.pr currentmatches the current git branch against open pull requests’ source branch. It reads the branch from.git, and the workspace and repository from--wsand--repoor the connection, never from the remote.pipeline logsfollows a redirect to signed storage with every header dropped, so the credential stays onbaseUrl’s host. Pipeline and step uuids are taken with or without their braces.- Not covered: Issues and Wikis (removed from Bitbucket Cloud in August 2026), the cross-workspace APIs (retired in April 2026), anything only a Connect app can reach, starting or stopping a pipeline, and deleting branches, tags or repositories.
- A 429 is retried after the delay Bitbucket asks for, as in every area.
Moving from bitbucket-cloud
Bitbucket Cloud used to be its own area. It is bitbucket with "deployment": "cloud" now,
and the old names are gone, not deprecated:
- Config: a version 1 or 2 file loads as it is: a connection with
"area": "bitbucket-cloud"is read as"area": "bitbucket", "deployment": "cloud", anddefaults.bitbucket-cloudfolds intodefaults.bitbucketwith care, becausedefaults.bitbucketreaches every Bitbucket connection. The connection default folds as is. A Cloud default for another key (workspace,repo) moves todefaults.bitbucketonly when no Data Center connection would inherit it, and is otherwise written onto the Cloud connections. In the other direction, when a file has both moved Cloud connections and Data Center ones, each shared keydefaults.bitbucketalready had (project,repo,targetBranch) is written onto the Data Center connections and leavesdefaults.bitbucket, so it doesn’t start reaching Cloud. Any command that saves a connection writes the file back as version 3 (so does the welcome menu’s game save). Keychain entries are untouched. A version 3 file that still says"area": "bitbucket-cloud"warns withCONFIG_RENAMED_AREA, naming the new form. CONFIG_DEFAULT_KEPT: when both areas named a default connection,bitbucket’s stays the default and the warning names the Cloud one that was set aside.toil connections migratesaves the file as version 3 and clears the warning.- Toil UI and older toil: a version 3 file is refused by toil 0.1.0-beta.2, so toil UI’s pin moves to the toil release that has this change.
- Commands and tools: the
bitbucket-cloudcommand path isbitbucket, thebitbucket_cloud_*tools arebitbucket_*, and--areas bitbucket-cloudis--areas bitbucket.pr request-changesis an alias ofpr needs-work, whose tool isbitbucket_pr_needs_work. The old forms fail withINVALID_INPUTnaming the new one. - Env vars:
TOIL_BITBUCKET_CLOUD_*is refused withCONFIG_INVALID; useTOIL_BITBUCKET_*withTOIL_BITBUCKET_DEPLOYMENT=cloud, orTOIL_CONN_<NAME>_*withTOIL_CONN_<NAME>_DEPLOYMENT=cloud.TOIL_CONN_<NAME>_AREA=bitbucket-cloudis refused the same way, withTOIL_CONN_<NAME>_AREA=bitbucketandTOIL_CONN_<NAME>_DEPLOYMENT=cloudas the fix. An emptyTOIL_BITBUCKET_CLOUD_*is skipped unlessTOIL_STRICT_ENV=true, which refuses it too (seecore.md, Configuration). - Old
TOIL_BITBUCKET_*values on a Cloud default:TOIL_BITBUCKET_*reaches bitbucket’s default connection. When that connection is Cloud (a migratedbitbucket-cloudone, ordeploymentset indefaults.bitbucket) andTOIL_BITBUCKET_DEPLOYMENTisn’t set, the call fails withCONFIG_INVALIDnaming the variables, so Data Center values and a token never land on Bitbucket Cloud by accident. SetTOIL_BITBUCKET_DEPLOYMENT=cloudif the values are Cloud ones, or define a separate Data Center connection withTOIL_CONN_<NAME>_*.TOIL_CONN_<NAME>_*is never affected. - Dossiers: a
bitbucket-cloudsection is read asbitbucket(also under an environment and in a person’sids), with aDOSSIER_RENAMED_AREAwarning to rename it (toil dossiers checkreports it). With both,bitbucketwins. A dossier has onebitbucketsection, so it picks one Bitbucket connection: a body of work that uses both a Data Center and a Cloud Bitbucket takes two dossiers. A person keeps one Bitbucket id per dossier now (a username on Data Center, an account id on Cloud), as with Jira. - Pipelines:
BITBUCKET_WORKSPACEandBITBUCKET_REPO_SLUGstill fillworkspaceandrepo, but only on a default connection that is Cloud, and the default is Data Center unless you say otherwise. SetTOIL_BITBUCKET_DEPLOYMENT=cloudin the pipeline.
Checking a dossier
check-dossier checks the call’s dossier on a Data Center connection: each project key it names (project, per repo or not, and projects) exists, and each repository (repo) in its project. It’s toil bitbucket check-dossier (--dossier <name|file>, or the dossier the folder resolves to), and it returns { dossier, connection, env, ok, checked, checks, unchecked }, one check per value with its key path. The CLI exits 1 when one is missing. A failure other than not-found (a bad token, an unreachable host) fails the command. Read only. A Cloud connection gets UNSUPPORTED.
Settings at a glance
-
baseUrlrequiredBitbucket root: the Data Center server (https://bitbucket.imagile.dev), or the Cloud REST API root (https://api.bitbucket.org/2.0)
TOIL_BITBUCKET_BASE_URL -
deploymentWhich Bitbucket this is: "server" for Data Center (the default), or "cloud" for Bitbucket Cloud
TOIL_BITBUCKET_DEPLOYMENT -
patsecretData Center: an HTTP access token
TOIL_BITBUCKET_PAT -
emailBitbucket Cloud only: the email address of the Atlassian account an API token belongs to (with apiToken)
TOIL_BITBUCKET_EMAIL -
apiTokensecretBitbucket Cloud only: an Atlassian API token with Bitbucket scopes, sent as Basic auth with email
TOIL_BITBUCKET_API_TOKEN -
accessTokensecretBitbucket Cloud only: a workspace, project or repository access token, sent as Bearer
TOIL_BITBUCKET_ACCESS_TOKEN -
projectData Center: default project key
TOIL_BITBUCKET_PROJECT -
workspaceBitbucket Cloud: default workspace slug
TOIL_BITBUCKET_WORKSPACEorBITBUCKET_WORKSPACE -
repoDefault repository slug
TOIL_BITBUCKET_REPOorBITBUCKET_REPO_SLUG -
targetBranchData Center: default target branch for pr create (main when unset)
TOIL_BITBUCKET_TARGET_BRANCH
Commands at a glance
toil bitbucket repo createwriteCreate a new repository in a project (Data Center) or a workspace (Cloud)
toil bitbucket pr listList pull requests
toil bitbucket pr getGet a pull request by ID
toil bitbucket pr createwriteCreate a pull request
toil bitbucket pr create-manywriteCreate pull requests for multiple repositories in a project
toil bitbucket pr updatewriteUpdate a pull request
toil bitbucket pr mergewriteMerge a pull request
toil bitbucket pr declinewriteDecline a pull request
toil bitbucket pr currentalsotoil git current-prFind the open PR for the current branch
toil bitbucket pr commentsList comments on a pull request (includes threaded replies by default)
toil bitbucket pr commentwriteAdd a comment to a pull request
toil bitbucket pr comment-inlinewriteAdd an inline comment to a file in a pull request
toil bitbucket pr replywriteReply to a comment on a pull request
toil bitbucket pr resolvewriteResolve a comment thread on a pull request (use the root comment ID, not a reply)
toil bitbucket pr delete-commentwriteCLI onlyDelete a comment on a pull request
toil bitbucket pr diffGet the diff of a pull request (on Cloud, or of a commit spec)
toil bitbucket pr filesList files changed in a pull request
toil bitbucket pr approvewriteApprove a pull request
toil bitbucket pr unapprovewriteRemove approval from a pull request
toil bitbucket pr needs-workwritealsotoil bitbucket pr request-changesMark a pull request as needs-work (Cloud: request changes)
toil bitbucket pr reviewersList reviewers of a pull request
toil bitbucket repo default-reviewersList a repository's default reviewers (Data Center: its default-reviewer conditions)
toil bitbucket pr add-reviewerwriteAdd a reviewer to a pull request
toil bitbucket pr buildsList build statuses for a pull request
toil bitbucket commit statusGet build statuses for a commit SHA
toil bitbucket check-dossierCheck the call's dossier against Bitbucket: its projects and repositories exist
toil bitbucket repo listList repositories in a workspace
toil bitbucket repo getGet a repository
toil bitbucket branch listList branches in a repository
toil bitbucket branch createwriteCreate a branch at a commit
toil bitbucket tag listList tags in a repository
toil bitbucket tag createwriteCreate an annotated tag at a commit
toil bitbucket commit listList commits, newest first
toil bitbucket commit getGet a commit by hash
toil bitbucket file getGet a file's contents at a ref
toil bitbucket file listList a folder's entries at a ref
toil bitbucket pipeline listList pipeline runs, newest first
toil bitbucket pipeline getGet a pipeline run
toil bitbucket pipeline stepsList a pipeline run's steps
toil bitbucket pipeline logsGet a pipeline step's log
toil bitbucket apiwriteCall any Bitbucket Cloud REST endpoint on the connection, e.g. toil bitbucket api GET /repositories/imagile/toil