Azure Pipelines: PR Preview Environments
- Applies to
- Gatewayruntime for API, AI, and MCP gateways
- Hosting
- Managed EdgeManaged DedicatedSelf-HostedDiffers
1 difference by hosting option
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.
azure-pipelines.yml
The deploy step passes --branch with the pull request's source branch. Without
it, a pull request build can create an environment named after the merge ref
instead of your branch. Azure Pipelines sets System.PullRequest.SourceBranch
to a full ref such as refs/heads/my-feature, so the script strips the
refs/heads/ prefix. The variable is set only when a branch policy triggers the
build, so the script falls back to Build.SourceBranch for other runs. The
values reach the script through env instead of being written into it.
The cleanup step only runs for pull requests, deleting the preview environment by the same branch name after tests pass.
Next Steps
- Implement multi-stage deployment for production