Skip to content

Azure DevOps

Trigger Smoketest deployment webhooks from Azure Pipelines after a deployment job.

View as Markdown

Use Azure Pipelines when deployment is part of a YAML pipeline. Add a script step after deployment and pass the target URL plus Azure build variables.

Before you start

  1. Create a deployment webhook in Smoketest.
  2. Store the trigger URL as a secret variable named SMOKETEST_DEPLOYMENT_WEBHOOK_URL.
  3. Store the deployed URL in DEPLOYMENT_URL, or omit targetUrl for saved-test production URLs.

Pipeline example

azure-pipelines.yml
trigger:
  branches:
    include:
      - main

stages:
  - stage: Deploy
    jobs:
      - job: deploy
        steps:
          - script: ./scripts/deploy.sh
            displayName: Deploy

          - script: |
              curl -sf -X POST -G "$(SMOKETEST_DEPLOYMENT_WEBHOOK_URL)" \
                -H "Idempotency-Key: $(Build.BuildId)" \
                --data-urlencode "targetUrl=$(DEPLOYMENT_URL)" \
                --data-urlencode "commitSha=$(Build.SourceVersion)" \
                --data-urlencode "branch=$(Build.SourceBranchName)" \
                --data-urlencode "externalId=$(Build.BuildId)"
            displayName: Trigger Smoketest
            env:
              DEPLOYMENT_URL: https://staging.example.com

Deployment jobs

If you use Azure deployment jobs, place the Smoketest step after the deployment commands inside the same environment strategy.

azure-pipelines.yml
- deployment: deploy_production
  environment: production
  strategy:
    runOnce:
      deploy:
        steps:
          - script: ./scripts/deploy.sh
          - script: |
              curl -sf -X POST -G "$(SMOKETEST_DEPLOYMENT_WEBHOOK_URL)" \
                -H "Idempotency-Key: $(Build.BuildId)" \
                --data-urlencode "targetUrl=$(DEPLOYMENT_URL)" \
                --data-urlencode "commitSha=$(Build.SourceVersion)" \
                --data-urlencode "branch=$(Build.SourceBranchName)" \
                --data-urlencode "externalId=$(Build.BuildId)"

On this page