Bitbucket

Bitbucket Pipelines: Local testing in CI

Test against a local Zuplo server before deploying anywhere.

YAMLbitbucket-pipelines.yml
image: node:24 pipelines: branches: main: - step: name: Local Testing script: - npm install - npx zuplo dev & # Poll until the server answers — never a fixed sleep - | deadline=$((SECONDS + 60)) until curl --fail --silent --output /dev/null http://localhost:9000/health; do if (( SECONDS >= deadline )); then echo "Local server did not start within 60s" >&2 exit 1 fi sleep 1 done - npx zuplo test --endpoint http://localhost:9000 - kill %1 - step: name: Deploy to Zuplo script: - npm install - npx zuplo deploy --api-key "$ZUPLO_API_KEY"

Local tests run first. Only if they pass does deployment proceed.

The readiness poll replaces a fixed sleep. A sleep is a guess about startup time that is wrong in both directions, and it is the most common reason a gateway test suite "needs" a retry. The example polls /health — add an unauthenticated health route if your gateway does not have one. See health checks.

Next steps

Last modified on