Azure DevOps
Trigger Smoketest deployment webhooks from Azure Pipelines after a deployment job.
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
- Create a deployment webhook in Smoketest.
- Store the trigger URL as a secret variable named
SMOKETEST_DEPLOYMENT_WEBHOOK_URL. - Store the deployed URL in
DEPLOYMENT_URL, or omittargetUrlfor saved-test production URLs.
Pipeline example
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.comDeployment jobs
If you use Azure deployment jobs, place the Smoketest step after the deployment commands inside the same environment strategy.
- 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)"