Bitbucket (self-hosted)
Port's Bitbucket (Self-Hosted) integration brings Bitbucket Server / Bitbucket Data Center resources into your context lake so people and agents can query them.
Core support
Note: While Bitbucket Server has been deprecated and replaced by Bitbucket Data Center, they expose the same set of APIs and this integration covers both. For Bitbucket Cloud, see the Bitbucket Cloud integration.
Setup
Choose one of the following installation methods: Not sure which method is right for your use case? Check the available installation methods.
The prerequisites required for installation are listed below.
-
Go to the BitbucketServer Connectors page in Port.
-
Under
Select your installation method, chooseHosted by Port. -
Toggle on
Use Custom Settingsand Configure theInstallation parametersandAdvanced configurationas you wish (see below for details).
Installation parameters
Each integration requires specific parameters (such as an API token, a URL, etc.), as seen in Port's UI when installing it. Hover over the ⓘ icon next to each parameter to see more details about it.
Advanced configuration
- During the installation process each integration may have additional settings under the
Advanced configurationsection in Port's UI. Additionally, each integration has one or more settings that can be configured after installation. To do so, click on the integration's name in the Connectors page and navigate to theSettingtab. Hover over the ⓘ icon next to each setting to see more details about it.
Port secrets
Some integration settings require sensitive pieces of data, such as tokens. For these settings, Port secrets will be used, ensuring that your sensitive data is encrypted and secure.
When filling in such a setting, its value will be obscured (shown as ••••••••).
For each such setting, Port will automatically create a secret in your organization.
To see all secrets in your organization, follow these steps.
Port source IP addresses
When using this installation method, Port will make outbound calls to your 3rd-party applications from static IP addresses. You may need to add these addresses to your allowlist, in order to allow Port to interact with the integrated service:
- Europe (EU):
54.73.167.226,63.33.143.237,54.76.185.219 - United States (US):
3.234.37.33,54.225.172.136,3.225.234.99
-
Go to the Bitbucket-server Connectors page in the Port app.
-
Select the
Self-hostedmethod. -
A
helmcommand will be displayed, with default values already filled out (e.g. your Port client ID, client secret, etc). Copy the command, replace the placeholders with your values, then run it in your terminal to install the integration.
Required parameters:
port.clientId- Your Port client ID (How to get the credentials).port.clientSecret- Your Port client secret (How to get the credentials).port.baseUrl- Your Port API URL -https://api.port.iofor EU,https://api.us.port.iofor US.integration.identifier- Change the identifier to describe your integration.integration.type- The integration type.integration.eventListener.type- The event listener type.integration.config.bitbucketUsername- Bitbucket username.integration.secrets.bitbucketPassword- Bitbucket password.integration.config.bitbucketBaseUrl- Bitbucket base url.
Optional parameters (click to expand)
integration.secrets.bitbucketWebhookSecret- Bitbucket webhook secret used to verify the webhook request.integration.config.bitbucketIsVersion8Point7OrOlder- Bitbucket is version 8.7 or older. Set totrueif you are using Bitbucket (Self-Hosted) version 8.7 or older. This is because webhook events are setup differently in Bitbucket (Self-Hosted) 8.7 and above.scheduledResyncInterval- The number of minutes between each resync.initializePortResources- Default true, When set to true the integration will create default blueprints and the port App config Mapping.sendRawDataExamples- Enable sending raw data examples from the third party API to port for testing and managing the integration mapping. Default is true.integration.config.bitbucketRateLimitQuota- Maximum number of API requests allowed within the rate limit window. Default is1000.integration.config.bitbucketRateLimitWindow- Time window in seconds for rate limiting. Default is3600(1 hour).liveEvents.baseUrl- The base url of the instance where the Bitbucket (Self-Hosted) integration is hosted, used for real-time updates. (e.g.https://mybitbucket-self-hosted-ocean-integration.com).
If you're running high volumes of live events in a self-hosted deployment and want better reliability, event durability, or horizontal scalability, you can optionally set up Port's dedicated live events infrastructure. See live events at scale for details.
Recommended resource sizes
To ensure optimal performance and avoid out-of-memory (OOM) errors, we recommend the following resources for this integration:
- CPU Limit:
800m - CPU Request:
100m - Memory Limit:
1Gi - Memory Request:
1Gi
Set resource values
helm install my-integration port-labs/port-ocean \
# ... other parameters
--set resources.limits.cpu=800m \
--set resources.limits.memory=1Gi \
--set resources.requests.cpu=100m \
--set resources.requests.memory=1Gi
- GitHub
- Jenkins
- Azure DevOps
- GitLab
- Go to the BitbucketServer Connectors page in the Port app.
- Under Select your installation method, choose your desired CI/CD platform.
- Copy the workflow and replace the placeholders with your values.
Below are the available parameters and their descriptions.
| Parameter | Description | Required? | Secret?Store this value as a GitHub Actions secret |
|---|---|---|---|
port_client_id | Your Port client ID (How to get the credentials). | ✓ | ✓ |
port_client_secret | Your Port client secret (How to get the credentials). | ✓ | ✓ |
port_base_url | Your Port API URL (https://api.port.io for EU, https://api.us.port.io for US). | ✓ | ✗ |
bitbucket_username | Bitbucket username. | ✓ | ✓ |
bitbucket_password | Bitbucket password. | ✓ | ✓ |
bitbucket_base_url | Bitbucket base url. | ✓ | ✓ |
bitbucket_is_version8_point7_or_older | Bitbucket is version 8.7 or older. Set to true if you are using Bitbucket (Self-Hosted) version 8.7 or older. This is because webhook events are setup differently in Bitbucket (Self-Hosted) 8.7 and above. | ✗ | ✗ |
bitbucket_rate_limit_quota | Maximum number of API requests allowed within the rate limit window. Default is 1000. | ✗ | ✗ |
bitbucket_rate_limit_window | Time window in seconds for rate limiting. Default is 3600 (1 hour). | ✗ | ✗ |
initialize_port_resources | Default true. When set to true, the integration will create default blueprints and the Port app config mapping. | ✗ | ✗ |
integration_identifier | The identifier of the integration that will be installed. | ✗ | ✗ |
send_raw_data_examples | Enable sending raw data examples from the third-party API to Port for testing and managing the integration mapping. Default is true. | ✗ | ✗ |
Your Jenkins agent must be able to run Docker commands.
Below are the available parameters and their descriptions.
| Parameter | Description | Required? | Secret?Store this value as a Jenkins credential (Secret Text) |
|---|---|---|---|
OCEAN__ | Your Port client ID (How to get the credentials). | ✓ | ✓ |
OCEAN__ | Your Port client secret (How to get the credentials). | ✓ | ✓ |
OCEAN__ | Your Port API URL (https://api.port.io for EU, https://api.us.port.io for US). | ✓ | ✗ |
OCEAN__ | Bitbucket username. | ✓ | ✓ |
OCEAN__ | Bitbucket password. | ✓ | ✓ |
OCEAN__ | Bitbucket base url. | ✓ | ✓ |
OCEAN__ | Bitbucket is version 8.7 or older. Set to true if you are using Bitbucket (Self-Hosted) version 8.7 or older. This is because webhook events are setup differently in Bitbucket (Self-Hosted) 8.7 and above. | ✗ | ✗ |
OCEAN__ | Maximum number of API requests allowed within the rate limit window. Default is 1000. | ✗ | ✗ |
OCEAN__ | Time window in seconds for rate limiting. Default is 3600 (1 hour). | ✗ | ✗ |
OCEAN__ | Default true. When set to true, the integration will create default blueprints and the Port app config mapping. | ✗ | ✗ |
OCEAN__ | The identifier of the integration that will be installed. | ✗ | ✗ |
OCEAN__ | Enable sending raw data examples from the third-party API to Port for testing and managing the integration mapping. Default is true. | ✗ | ✗ |
Here is an example for a Jenkinsfile pipeline file:Jenkins pipeline (click to expand)
Prerequisites
- Your Azure Devops agent should be able to run docker commands. Learn more about agents here.
- You must have permissions to create and manage Azure DevOps variable groups for storing credentials.
Set up your credentials
- Create a Variable Group: Name it port-ocean-credentials.
- Store the required variables (see the table below).
- Authorize Your Pipeline:
-
Go to "Library" -> "Variable groups."
-
Find port-ocean-credentials and click on it.
-
Select "Pipeline Permissions" and add your pipeline to the authorized list.
-
Below are the available parameters and their descriptions.
| Parameter | Description | Required? | Secret?Store this value as an Azure DevOps pipeline variable |
|---|---|---|---|
OCEAN__ | Your Port client ID (How to get the credentials). | ✓ | ✓ |
OCEAN__ | Your Port client secret (How to get the credentials). | ✓ | ✓ |
OCEAN__ | Your Port API URL (https://api.port.io for EU, https://api.us.port.io for US). | ✓ | ✗ |
OCEAN__ | Bitbucket username. | ✓ | ✓ |
OCEAN__ | Bitbucket password. | ✓ | ✓ |
OCEAN__ | Bitbucket base url. | ✓ | ✓ |
OCEAN__ | Bitbucket is version 8.7 or older. Set to true if you are using Bitbucket (Self-Hosted) version 8.7 or older. This is because webhook events are setup differently in Bitbucket (Self-Hosted) 8.7 and above. | ✗ | ✗ |
OCEAN__ | Maximum number of API requests allowed within the rate limit window. Default is 1000. | ✗ | ✗ |
OCEAN__ | Time window in seconds for rate limiting. Default is 3600 (1 hour). | ✗ | ✗ |
OCEAN__ | Default true. When set to true, the integration will create default blueprints and the Port app config mapping. | ✗ | ✗ |
OCEAN__ | The identifier of the integration that will be installed. | ✗ | ✗ |
OCEAN__ | Enable sending raw data examples from the third-party API to Port for testing and managing the integration mapping. Default is true. | ✗ | ✗ |
Here is an example for a azure-pipeline.yml pipeline file:Azure pipeline (click to expand)
- Go to the BitbucketServer Connectors page in the Port app.
- Under Select your installation method, choose your desired CI/CD platform.
- Copy the workflow and replace the placeholders with your values.
Below are the available parameters and their descriptions.
| Parameter | Description | Required? | Secret?Store this value as a GitLab CI/CD variable |
|---|---|---|---|
OCEAN__ | Your Port client ID (How to get the credentials). | ✓ | ✓ |
OCEAN__ | Your Port client secret (How to get the credentials). | ✓ | ✓ |
OCEAN__ | Your Port API URL (https://api.port.io for EU, https://api.us.port.io for US). | ✓ | ✗ |
OCEAN__ | Bitbucket username. | ✓ | ✓ |
OCEAN__ | Bitbucket password. | ✓ | ✓ |
OCEAN__ | Bitbucket base url. | ✓ | ✓ |
OCEAN__ | Bitbucket is version 8.7 or older. Set to true if you are using Bitbucket (Self-Hosted) version 8.7 or older. This is because webhook events are setup differently in Bitbucket (Self-Hosted) 8.7 and above. | ✗ | ✗ |
OCEAN__ | Maximum number of API requests allowed within the rate limit window. Default is 1000. | ✗ | ✗ |
OCEAN__ | Time window in seconds for rate limiting. Default is 3600 (1 hour). | ✗ | ✗ |
OCEAN__ | Default true. When set to true, the integration will create default blueprints and the Port app config mapping. | ✗ | ✗ |
OCEAN__ | The identifier of the integration that will be installed. | ✗ | ✗ |
OCEAN__ | Enable sending raw data examples from the third-party API to Port for testing and managing the integration mapping. Default is true. | ✗ | ✗ |
Configuration
Port integrations use a YAML mapping block to ingest data from the third-party api into Port.
The mapping makes use of the JQ JSON processor to select, modify, concatenate, transform and perform other operations on existing fields and values from the integration API.
Filtering data
The integration supports several selector properties to control which data is ingested from Bitbucket Server into Port.
Filtering projects
You can filter projects by providing a list of specific project keys using the projects selector. When set, only repositories belonging to the listed projects are ingested:
Filter by project keys (click to expand)
resources:
- kind: repository
selector:
query: "true"
projects:
- "PROJ"
- "TEAM-A"
port:
entity:
mappings:
identifier: .slug
title: .name
blueprint: '"bitbucketRepository"'
properties:
description: .description
state: .state
forkable: .forkable
public: .public
link: .links.self[0].href
relations:
project: .project.key
The projects selector is available for the project, repository, and pull-request kinds, and applies the same filtering to those resources.
Filtering projects using regex
You can also use the projectFilterRegex selector to filter projects by a regex pattern applied to project keys. This is useful when you want to match a set of projects by naming convention:
Filter by project regex (click to expand)
resources:
- kind: repository
selector:
query: "true"
projectFilterRegex: "^TEAM-.*"
port:
entity:
mappings:
identifier: .slug
title: .name
blueprint: '"bitbucketRepository"'
properties:
description: .description
state: .state
forkable: .forkable
public: .public
link: .links.self[0].href
relations:
project: .project.key
Common regex patterns include:
^TEAM-.*— matches projects whose keys start withTEAM-..*-PROD$— matches projects whose keys end with-PROD.^(PROJ|INFRA)$— matches the exact keysPROJorINFRA.
When both projects and projectFilterRegex are set on the same resource kind, both conditions must match (AND logic). A project will only be included if its key appears in the projects list and matches the projectFilterRegex pattern.
Filtering pull request state
For the pull-request kind, you can use the state selector to control which pull requests are ingested. Accepted values are ALL, OPEN, MERGED, and DECLINED. The default is OPEN:
Filter pull request state (click to expand)
resources:
- kind: pull-request
selector:
query: "true"
state: "ALL"
port:
entity:
mappings:
identifier: .id | tostring
title: .title
blueprint: '"bitbucketPullRequest"'
properties:
created_on: .createdDate | (tonumber / 1000 | strftime("%Y-%m-%dT%H:%M:%SZ"))
updated_on: .updatedDate | (tonumber / 1000 | strftime("%Y-%m-%dT%H:%M:%SZ"))
state: .state
owner: .author.user.emailAddress
link: .links.self[0].href
destination: .toRef.displayId
source: .fromRef.displayId
relations:
repository: .toRef.repository.slug
You can combine all the selectors together. For example, to sync only OPEN pull requests from projects matching a regex:
Combine selectors (click to expand)
resources:
- kind: pull-request
selector:
query: "true"
projectFilterRegex: "^TEAM-.*"
state: "OPEN"
port:
entity:
mappings:
identifier: .id | tostring
title: .title
blueprint: '"bitbucketPullRequest"'
properties:
created_on: .createdDate | (tonumber / 1000 | strftime("%Y-%m-%dT%H:%M:%SZ"))
updated_on: .updatedDate | (tonumber / 1000 | strftime("%Y-%m-%dT%H:%M:%SZ"))
state: .state
owner: .author.user.emailAddress
link: .links.self[0].href
destination: .toRef.displayId
source: .fromRef.displayId
relations:
repository: .toRef.repository.slug
Default mapping configuration
This is the default mapping configuration for this integration:
Default mapping configuration (click to expand)
createMissingRelatedEntities: true
deleteDependentEntities: true
resources:
- kind: project
selector:
query: "true"
port:
entity:
mappings:
identifier: .key
title: .name
blueprint: '"bitbucketProject"'
properties:
public: .public
type: .type
description: .description
link: .links.self[0].href
- kind: repository
selector:
query: "true"
port:
entity:
mappings:
identifier: .slug
title: .name
blueprint: '"bitbucketRepository"'
properties:
description: .description
state: .state
forkable: .forkable
public: .public
link: .links.self[0].href
documentation: .__readme
relations:
project: .project.key
latestCommitAuthor: .__latestCommit.author.emailAddress
- kind: pull-request
selector:
query: "true"
port:
entity:
mappings:
identifier: (.toRef.repository.slug // .toRef.repository.project.key) + "-" + (.id|tostring)
title: .title
blueprint: '"bitbucketPullRequest"'
properties:
created_on: .createdDate | (tonumber / 1000 | strftime("%Y-%m-%dT%H:%M:%SZ"))
updated_on: .updatedDate | (tonumber / 1000 | strftime("%Y-%m-%dT%H:%M:%SZ"))
merge_commit: .fromRef.latestCommit
state: .state
owner: .author.user.emailAddress
link: .links.self[0].href
destination: .toRef.displayId
source: .fromRef.displayId
mergedAt: .closedDate as $d | if $d == null then null else ($d / 1000 | strftime("%Y-%m-%dT%H:%M:%SZ")) end
reviewers: "[.reviewers[].user.emailAddress]"
relations:
repository: .toRef.repository.slug
participants: "[.participants[].user.emailAddress]"
- kind: user
selector:
query: "true"
port:
entity:
mappings:
identifier: .emailAddress
title: .displayName
blueprint: '"bitbucketUser"'
properties:
username: .name
url: .links.self[0].href
portUser: .emailAddress
Mapping & selectors per resource
To view and test the integration's mapping against examples of the third-party API responses, use the jq playground in your connectors page. Find the integration in the list of connectors and click on it to open the playground.
- kind: project
selector:
query: "true"
port:
entity:
mappings:
identifier: .key
title: .name
blueprint: '"bitbucketProject"'
properties:
public: .public
type: .type
description: .description
link: .links.self[0].href
{
"key": "PROJ",
"id": 1,
"name": "Project",
"public": false,
"type": "NORMAL",
"links": {
"self": [
{
"href": "http://localhost:7990/projects/PROJ"
}
]
}
}
{
"blueprint": "bitbucketProject",
"identifier": "PROJ",
"createdAt": "2025-05-20T09:14:22.361Z",
"updatedBy": "jqoQ34Azuy08BJFFUZAKyP3sXranvmgc",
"createdBy": "jqoQ34Azuy08BJFFUZAKyP3sXranvmgc",
"team": [],
"title": "Project",
"relations": {},
"properties": {
"public": false,
"link": "http://localhost:7990/projects/PROJ",
"description": null,
"type": "NORMAL"
},
"updatedAt": "2025-05-22T20:46:27.616Z"
}
Below are the supported selectors for this resource. Use them under the selector key in your integration mapping configuration to control which resources are returned from the API.
| Selector | Type | Description |
|---|---|---|
exportEnvVariables | array | Environment variable names whose values should be included in lakehouse ingest payloads for DSP processing. |
projects | array | List of project keys to filter. If empty, all projects will be synced |
projectFilterRegex | string | Optional regex pattern to filter project keys (e.g., '^PROJ-.' to include only projects starting with 'PROJ-', or '.-PROD$' to include only projects ending with '-PROD') |
Set up live events
This integration supports live events, allowing real-time updates to your context lake without waiting for the next scheduled sync.
Note that different events are supported depending on the resource type.
pr:modifiedpr:openedpr:mergedpr:reviewer:updatedpr:declinedpr:deletedpr:comment:deletedpr:from_ref_updatedpr:comment:editedpr:reviewer:unapprovedpr:reviewer:needs_workpr:reviewer:approvedpr:comment:addedrepo:modifiedrepo:refs_changedproject:modified- Hosted by Port
- Self-hosted
Live events base URL
For integrations installed using the Hosted by Port method, you can obtain the live events base URL from the Get an integration API. The response includes liveEventsUuid and liveEventsIngestHostname in the appSpec section.
Call the endpoint with your integration's identifier:
curl -X GET \
'https://api.port.io/v1/integration/<INTEGRATION_IDENTIFIER>' \
-H 'Authorization: Bearer <PORT_ACCESS_TOKEN>'
The port_region, port.baseUrl, portBaseUrl, port_base_url and OCEAN__PORT__BASE_URL parameters select which Port API instance to use:
- EU (app.port.io) →
https://api.port.io - US (app.us.port.io) →
https://api.us.port.io
In the response, look for the following fields under spec.appSpec:
{
"spec": {
"appSpec": {
"liveEventsUuid": "abcdefghijk",
"liveEventsIngestHostname": "ingest.ocean.getport.io"
}
}
}
Combine them to build the live events base URL:
https://<liveEventsIngestHostname>/live-events/<liveEventsUuid>
For example, with the values above, the live events base URL is:
https://ingest.ocean.getport.io/live-events/abcdefghijk
This is the same URL configured for the integration.
BaseUrl & webhook configuration
To enable real-time updates of the data in your context lake, you need to define the liveEvents.baseUrl parameter.
This parameter should be set to the URL of your Bitbucket (self-hosted) integration instance, which needs to have the option to setup webhooks via HTTP requests/receive HTTP requests, so ensure the network is configured accordingly.
- If Bitbucket (self-hosted) and the integration are in the same cluster/network: Use an internal URL (e.g., a Kubernetes service DNS name).
For Kubernetes deployments, create a service to expose the integration pod and use the service URL asliveEvents.baseUrl. If both the source system and integration are in the same cluster, an internal ClusterIP service is sufficient. - If Bitbucket (self-hosted) is external to the integration's network: The integration must be exposed via an ingress, load balancer, or public URL that Bitbucket (self-hosted) can reach.
If you're running high volumes of live events in a self-hosted deployment and want better reliability, event durability, or horizontal scalability, you can optionally set up Port's dedicated live events infrastructure. See live events at scale for details.
If liveEvents.baseUrl is not provided, the integration will continue to function correctly. In such a configuration, to retrieve the latest information from the target system, the scheduledResyncInterval parameter has to be set, or a manual resync will need to be triggered through Port's UI.
To test webhooks or live event delivery to your local environment, expose your local pod or service to the internet using ngrok (e.g. ngrok http http://localhost:8000)
Securing Your Webhooks
The integration.secrets.bitbucketWebhookSecret parameter secures your webhooks. If not provided, the integration will process webhooks without validating the source of the events.
Monitoring and sync status
To learn more about how to monitor and check the sync status of your integration, see the relevant documentation.
GitOps
The Bitbucket (Self-Hosted) Ocean integration by itself does not support GitOps yet. This capability is planned for a future release and is WIP. If you really need GitOps support, you can use the webhook gitops installation method.