feat(source-control): Bitbucket Data Center repositories #18241
main fromrefs/pull/18241/head·opened View on GitHubA self-hosted Bitbucket remote (Data Center or Server) is classified as Bitbucket Cloud, so T3 Code sends its requests, with any Cloud token, to api.bitbucket.org (#14591). There is also no way to look up or clone a Data Center repository. This PR adds Data Center as its own host, @t3tools/source-control-bitbucket-server, for repositories. Proposed in #10837. It stacks on #18240; pull requests follow in #18242. Only the last commit is new here. GitHub can't base a PR on a fork branch, so this one targets main and also shows #18240's commit.
Fixes #14591. It supersedes #14593, which marks these hosts unsupported until Data Center support exists.
Summary#
remote host
bitbucket.org -> bitbucket (Cloud, unchanged)
- any other `bitbucket` label -> bitbucket (sent to api.bitbucket.org)
+ any other `bitbucket` label -> bitbucket-server (sent only to the configured host)
packages/source-control-bitbucket-server/
├── client/definition.ts # kind, labels, PR URL shape, no publish
└── server/
├── BitbucketServerApi.ts # REST 1.0 over HttpClient: lookup, clone URLs, default branch, checkout
├── BitbucketServerSourceControlProvider.ts
├── bitbucketServerPullRequests.ts # branch pull request status
└── driver.ts # pullRequests: null until #18242
- Remotes:
https://host/scm/KEY/repo.git,ssh://git@host:7999/KEY/repo.git,~userpersonal repositories, and hosts served under a context path. Repository identity drops the context path and/scm/, so a clone URL and a browse URL name the same repository. - Credentials: one host URL plus an HTTP access token in Settings → Source Control. The token goes in the secret store, like the Cloud token.
T3CODE_BITBUCKET_SERVER_URLandT3CODE_BITBUCKET_SERVER_TOKENare the fallback. The token is only sent to the configured host. A remote on any other host fails with a clear error. - Not offered: publishing (
publishDescription: null). The docs say to create the repository on the host and clone it. - Outside the package: detection in
shared/sourceControl.ts, the PR URL shape inshared/changeRequestUrl.ts, registration inbuiltInDrivers.ts,sourceControlHostSecrets.ts, andclient-runtime, the settings search entry, a section indocs/user/source-control.md, plus knip, release smoke, and the lockfile.
Evidence#
Driven in a dev server against a real Data Center instance with a throwaway personal repository. The host name is blurred. Here the host is configured through the T3CODE_BITBUCKET_SERVER_* fallback, which is why the Settings fields are empty while the row reads Authenticated.
| Before: no Data Center host | After: Data Center authenticated |
|---|---|
| Clone picker offers Data Center | Lookup resolves a ~user repository |
|---|---|
Tests: BitbucketServerApi.test.ts (URL shapes, context paths, token only sent to the configured host, checkout), BitbucketServerSourceControlProvider.test.ts, RepositoryIdentityResolver.test.ts, changeRequestUrl.test.ts, sourceControl.test.ts, sourceControlClients.test.ts. Typecheck and knip pass.
Merge Danger#
Door: two-way
Blast Radius: self-hosted Bitbucket
Remotes on a bitbucket host other than bitbucket.org stop being treated as Cloud. Anyone relying on T3CODE_BITBUCKET_API_BASE_URL to reach such a host through the Cloud client loses that path. Per #14591's triage, that path could not work against Data Center anyway. One Data Center host per server.
🤖 Generated with Claude Code — Claude Opus 5.5 in T3 Code
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
juliusmarminge closed this
Sign in to join this conversation.
Note
This comment is posted by Julius' dot
#14591's triage approves stopping misrouted Cloud requests and treats Data Center support as a separate feature. This PR adds that integration, while #10837 still awaits scope approval. I'm closing it under the prior-approval requirement. Please obtain maintainer approval in #10837 and link it when requesting reconsideration.