Skip to content

Shell scripts and custom infrastructure

Trigger Smoketest deployment webhooks from shell scripts, SSH deploys, cron jobs, and custom infrastructure.

View as Markdown

Use the generic shell recipe when your deployment is not managed by a CI provider, or when you run deploys over SSH, cron, Nomad, systemd, Ansible, or a private orchestrator.

Minimal trigger

This queues runs against each test's saved URL.

Shell
curl -sf -X POST "$SMOKETEST_DEPLOYMENT_WEBHOOK_URL"

Trigger with metadata

Use query parameters when you know the deployed URL and commit.

Shell
curl -sf -X POST -G "$SMOKETEST_DEPLOYMENT_WEBHOOK_URL" \
  -H "Idempotency-Key: ${DEPLOYMENT_ID}" \
  --data-urlencode "targetUrl=${DEPLOYMENT_URL}" \
  --data-urlencode "commitSha=${COMMIT_SHA}" \
  --data-urlencode "branch=${BRANCH_NAME}" \
  --data-urlencode "externalId=${DEPLOYMENT_ID}"

Drop-in script

scripts/smoketest-after-deploy.sh
#!/usr/bin/env bash
set -euo pipefail

: "${SMOKETEST_DEPLOYMENT_WEBHOOK_URL:?missing Smoketest webhook URL}"

DEPLOYMENT_ID="${DEPLOYMENT_ID:-$(date +%s)}"
DEPLOYMENT_URL="${DEPLOYMENT_URL:-}"
COMMIT_SHA="${COMMIT_SHA:-$(git rev-parse HEAD 2>/dev/null || true)}"
BRANCH_NAME="${BRANCH_NAME:-$(git rev-parse --abbrev-ref HEAD 2>/dev/null || true)}"

args=(
  -sf
  -X POST
  -G "$SMOKETEST_DEPLOYMENT_WEBHOOK_URL"
  -H "Idempotency-Key: $DEPLOYMENT_ID"
  --data-urlencode "externalId=$DEPLOYMENT_ID"
)

if [ -n "$DEPLOYMENT_URL" ]; then
  args+=(--data-urlencode "targetUrl=$DEPLOYMENT_URL")
fi

if [ -n "$COMMIT_SHA" ]; then
  args+=(--data-urlencode "commitSha=$COMMIT_SHA")
fi

if [ -n "$BRANCH_NAME" ]; then
  args+=(--data-urlencode "branch=$BRANCH_NAME")
fi

curl "${args[@]}"

Call it after your deployment succeeds:

Shell
./scripts/deploy.sh
DEPLOYMENT_URL="https://staging.example.com" \
DEPLOYMENT_ID="deploy-$(date +%s)" \
./scripts/smoketest-after-deploy.sh

Idempotency

Use a deployment ID that stays stable across retries of the same deploy. Do not use one static value forever, or future deploys will be treated as duplicates.

On this page