Jenkins & Other CI/CD
VigilQA integrates with any CI/CD system that can make outbound HTTPS calls. The REST API pattern is the same regardless of platform.
Jenkins Declarative Pipeline
pipeline {
agent any
environment {
SF_TOKEN = credentials('vigilqa-api-token')
}
stages {
stage('VigilQA Tests') {
steps {
script {
def response = sh(
script: """
curl -s -X POST https://api.sentinelflux.in/v1/runs \\
-H "Authorization: Bearer ${SF_TOKEN}" \\
-H "Content-Type: application/json" \\
-d '{"project":"myapp","plan":"regression","context":{"commit_sha":"${GIT_COMMIT}"}}'
""",
returnStdout: true
).trim()
def runId = readJSON(text: response).run_id
env.SF_RUN_ID = runId
timeout(time: 30, unit: 'MINUTES') {
waitUntil {
def result = sh(
script: """
curl -s https://api.sentinelflux.in/v1/runs/${runId} \\
-H "Authorization: Bearer ${SF_TOKEN}" | jq -r '.status'
""",
returnStdout: true
).trim()
if (result == 'passed') return true
if (result == 'failed' || result == 'error') {
error("VigilQA run ${result}")
}
sleep(15)
return false
}
}
}
}
}
}
}
Generic shell script (any CI)
For any CI platform with shell script support:
#!/bin/bash
set -e
# Trigger run
RUN_ID=$(curl -s -X POST "https://api.sentinelflux.in/v1/runs" \
-H "Authorization: Bearer ${VIGILQA_API_TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"project\":\"${SF_PROJECT}\",\"plan\":\"${SF_PLAN}\"}" \
| jq -r '.run_id')
echo "Triggered run: $RUN_ID"
# Poll until complete (max 30 minutes)
for i in $(seq 1 120); do
STATUS=$(curl -s "https://api.sentinelflux.in/v1/runs/$RUN_ID" \
-H "Authorization: Bearer ${VIGILQA_API_TOKEN}" \
| jq -r '.status')
echo "Status: $STATUS"
case $STATUS in
passed) echo "Tests passed"; exit 0 ;;
failed) echo "Tests failed"; exit 1 ;;
error) echo "Run error"; exit 1 ;;
esac
sleep 15
done
echo "Timed out waiting for run"
exit 1
Environment variables reference
VIGILQA_API_TOKEN— API token from Settings → API TokensSF_PROJECT— your project slug (shown in the dashboard URL)SF_PLAN— the plan name to run (e.g.smoke,regression)