Bitbucket

Bitbucket Pipelines: PR Preview Environments

Applies to
Gatewayruntime for API, AI, and MCP gateways
Hosting
Managed EdgeManaged DedicatedSelf-HostedDiffers
1 difference by hosting option
Self-Hosted

Add --self-hosted-endpoint with your management API hostname to each zuplo deploy and zuplo delete command so it targets your cluster. See zuplo deploy.

Deploy preview environments for pull requests and clean up when they close.

YAMLbitbucket-pipelines.yml
image: node:24 pipelines: pull-requests: "**": - step: name: Deploy Preview script: - npm install - npx zuplo deploy --branch "$BITBUCKET_BRANCH" --api-key "$ZUPLO_API_KEY" 2>&1 | tee ./DEPLOYMENT_STDOUT - echo "DEPLOYMENT_URL=$(grep -oP 'Deployed to \K(https://[^ ]+)' ./DEPLOYMENT_STDOUT)" >> deployment.env artifacts: - deployment.env - step: name: Run Tests script: - source deployment.env - npm install - npx zuplo test --endpoint "$DEPLOYMENT_URL" - step: name: Cleanup Preview script: - npm install - npx zuplo delete --branch "$BITBUCKET_BRANCH" --api-key "$ZUPLO_API_KEY" --wait

The deploy step passes --branch with BITBUCKET_BRANCH, so the environment is named after the pull request's source branch. The cleanup step deletes the environment by the same branch name after tests complete.

Next Steps

Last modified on