Skip to main content

Bitbucket Server connections

The bitbucket-server connection type represents a Bitbucket Server or Bitbucket Data Center host. It has multiton cardinality and uses the host lookup strategy.

Configure Bitbucket Server​

app-config.yaml
connections:
- type: bitbucket-server
host: bitbucket.example.com
apiBaseUrl: https://bitbucket.example.com/rest/api/1.0
auth:
- method: token
token: ${BITBUCKET_SERVER_TOKEN}

Connection fields​

FieldTypeRequiredDescription
hoststringYesBitbucket host matched against the consumer's resource URL.
apiBaseUrlstringNoBase URL for Bitbucket's REST API.

Authentication methods​

MethodFieldTypeRequiredDescription
noneNone——Does not accept authentication fields.
tokentokenstringYesBitbucket access token.
basicusernamestringYesUsername for basic authentication.
basicpasswordstringYesPassword for basic authentication.

Use none explicitly for unauthenticated access to public content.

Lookup and selection​

The consumer supplies a lookup query containing a repository or content URL. The service selects the connection whose host matches the parsed URL host exactly.

When more than one authentication entry is visible to the calling plugin, the first visible entry is selected. Use plugin scoping to supply different credentials to a specific plugin; otherwise, configuration order determines which entry is selected.

Consume a Bitbucket Server connection​

const connection = await connections.find({
type: 'bitbucket-server',
query: { url: 'https://bitbucket.example.com/projects/ACME/repos/example' },
authMethods: ['token', 'basic', 'none'],
});

connection.apiBaseUrl; // string | undefined

if (connection.auth.method === 'token') {
connection.auth.token; // string
}

Return to the built-in connection type index.