Azure DevOps

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

YAMLazure-pipelines.yml
trigger: - main pr: - main pool: vmImage: ubuntu-latest steps: - task: NodeTool@0 inputs: versionSpec: "24.x" displayName: "Install Node.js" - script: npm install displayName: "Install dependencies" - script: | set -o pipefail npx zuplo deploy --api-key $(ZUPLO_API_KEY) 2>&1 | tee ./DEPLOYMENT_STDOUT displayName: "Deploy to Zuplo" - script: | DEPLOYMENT_URL=$(grep -oP 'Deployed to \K(https://[^ ]+)' ./DEPLOYMENT_STDOUT) echo "##vso[task.setvariable variable=DEPLOYMENT_URL]$DEPLOYMENT_URL" npx zuplo test --endpoint "$DEPLOYMENT_URL" displayName: "Run tests" - script: | npx zuplo delete --url $(DEPLOYMENT_URL) --api-key $(ZUPLO_API_KEY) --wait displayName: "Delete environment" condition: eq(variables['Build.Reason'], 'PullRequest')

The cleanup step only runs for pull requests, deleting the preview environment after tests pass.

Next Steps

Last modified on