Real-time risk cockpit combining SLOs, incidents and recent deployments.
Target: n/a
Current: 0.9%
Error budget remaining: 0%
Burn rate: 1.00x
No active change freeze window.
CI/CD pipelines use this endpoint to automatically check whether a service is safe to deploy based on real-time SLO health and burn-rate calculations. This API is protected using organisation-scoped tokens.
POST /api/safe-to-deploy/
GET /api/safe-to-deploy/?service=NAME&env=prod
Required Headers
X-API-TOKEN: <your token>
Content-Type: application/json (for POST)
{
"service_name": "Network",
"env": "prod"
}
Replace YOUR_TOKEN_HERE with your generated API token.
curl -sS \
-H "X-API-TOKEN: YOUR_TOKEN_HERE" \
-H "Content-Type: application/json" \
-X POST "https://sre.sydatrix.com/api/safe-to-deploy/" \
-d '{
"service_name": "Network",
"env": "prod"
}'
Save your token in Settings → Secrets → Actions as SAFE_TO_DEPLOY_TOKEN.
- name: Check Safe to Deploy
env:
SAFE_TO_DEPLOY_TOKEN: $
run: |
set -e
BASE_URL="https://sre.sydatrix.com"
SERVICE="Network"
ENV="prod"
RESPONSE=$(curl -sS \
-H "X-API-TOKEN: ${SAFE_TO_DEPLOY_TOKEN}" \
-H "Content-Type: application/json" \
-X POST "${BASE_URL}/api/safe-to-deploy/" \
-d "{\"service_name\": \"${SERVICE}\", \"env\": \"${ENV}\"}"
)
echo "$RESPONSE"
SAFE=$(echo "$RESPONSE" | jq -r '.safe')
if [ "$SAFE" != "true" ]; then
echo "❌ Not safe to deploy: $(echo "$RESPONSE" | jq -r '.reason')"
exit 1
fi
echo "✅ Safe to deploy"
Store the token as a Secret Text named safe_to_deploy_token.
stage('Safe to Deploy') {
steps {
withCredentials([string(credentialsId: 'safe_to_deploy_token', variable: 'SAFE_TO_DEPLOY_TOKEN')]) {
script {
def baseUrl = 'https://sre.sydatrix.com'
def service = 'Network'
def env = 'prod'
def payload = """{
"service_name": "${service}",
"env": "${env}"
}"""
def response = sh(
script: """
curl -sS \
-H "X-API-TOKEN: ${SAFE_TO_DEPLOY_TOKEN}" \
-H "Content-Type: application/json" \
-X POST '${baseUrl}/api/safe-to-deploy/' \
-d '${payload}'
""",
returnStdout: true
).trim()
echo "Safe-to-deploy response: ${response}"
def safe = sh(
script: "echo '${response}' | jq -r .safe",
returnStdout: true
).trim()
if (safe != 'true') {
def reason = sh(
script: "echo '${response}' | jq -r .reason",
returnStdout: true
).trim()
error "❌ Not safe to deploy: ${reason}"
}
echo "✅ Safe to deploy"
}
}
}
}
If deploying self-hosted and not multi-tenant, your platform may optionally use a single global API token stored as an environment variable:
export SAFE_TO_DEPLOY_API_TOKEN="YOUR-GLOBAL-TOKEN"
CI/CD pipelines still send it like:
X-API-TOKEN: YOUR-GLOBAL-TOKEN
The decision combines technical telemetry with business and customer context. These are the levers you can wire up: