Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(source-control): Bitbucket Data Center repositories #18241

ClosedOhadC(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/18241/headopened View on GitHub

A 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, ~user personal 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_URL and T3CODE_BITBUCKET_SERVER_TOKEN are 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 in shared/changeRequestUrl.ts, registration in builtInDrivers.ts, sourceControlHostSecrets.ts, and client-runtime, the settings search entry, a section in docs/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 hostAfter: Data Center authenticated
l2-before-settingsl2-after-settings
Clone picker offers Data CenterLookup resolves a ~user repository
l2-after-pickerl2-after-clone

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

    2. 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.

    3. juliusmarminge closed this

Sign in to join this conversation.