Complete reference for the Adaptive Deploy CLI tool.
The CLI provides command-line access to all deployment operations, designed for both interactive use and CI/CD automation.
graph LR
subgraph "CLI Commands"
Login[login]
Canary[canary deploy]
BlueGreen[blue-green deploy]
Control[start/pause/resume]
Status[status]
Rollback[rollback]
end
subgraph "API"
API[ADO API]
end
Login --> API
Canary --> API
BlueGreen --> API
Control --> API
Status --> API
Rollback --> API
# From source
cd cli
pip install -e .
# Verify installation
adaptive-deploy --version# API endpoint
export ADO_API_URL=http://localhost:8000
# Authentication token (obtained from login)
export ADO_TOKEN=your-jwt-token-hereCreate ~/.ado/config.yaml:
api_url: http://localhost:8000
default_environment: staging
default_namespace: defaultgraph TD
CLI[adaptive-deploy]
CLI --> Auth[Authentication]
CLI --> Deploy[Deployment]
CLI --> Control[Control]
CLI --> Monitor[Monitoring]
Auth --> Login[login]
Deploy --> Canary[canary deploy]
Deploy --> BlueGreen[blue-green deploy]
Control --> Start[start]
Control --> Pause[pause]
Control --> Resume[resume]
Control --> RB[rollback]
Monitor --> Status[status]
Monitor --> Health[health]
Available for all commands:
--api-url TEXT # API server URL (default: http://localhost:8000)
--token TEXT # Authentication token
--help # Show help messageLogin and obtain authentication token.
adaptive-deploy login [OPTIONS]Options:
--username TEXT: Username (prompted if not provided)--password TEXT: Password (prompted if not provided)
Examples:
# Interactive login
adaptive-deploy login
# Non-interactive login
adaptive-deploy login --username admin --password admin123
# Export token for later use
TOKEN=$(adaptive-deploy login --username admin --password admin123 | grep -oP 'Token: \K.*')
export ADO_TOKEN=$TOKENOutput:
✓ Login successful!
Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Export this token:
export ADO_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Create and optionally start a canary deployment.
adaptive-deploy canary deploy [OPTIONS]Required Options:
--service TEXT: Service name--version TEXT: Target version to deploy
Optional Parameters:
--environment [development|staging|production]: Target environment (default: staging)--steps TEXT: Comma-separated canary steps (default: 10,25,50,100)--metric TEXT: Metrics to monitor (format: name:threshold, can be used multiple times)--namespace TEXT: Kubernetes namespace (default: default)--auto-start / --no-auto-start: Start deployment automatically (default: false)
Examples:
# Basic canary deployment
adaptive-deploy canary deploy \
--service news-api \
--version v2.0.0
# Production deployment with custom steps and metrics
adaptive-deploy canary deploy \
--service news-api \
--version v2.0.0 \
--environment production \
--steps 5,10,25,50,75,100 \
--metric error_rate:0.02 \
--metric latency_p99:500 \
--metric success_rate:0.99 \
--auto-start
# CI/CD friendly (with auto-start)
adaptive-deploy canary deploy \
--service $SERVICE_NAME \
--version $CI_COMMIT_SHA \
--environment staging \
--auto-startOutput:
╭───────────────────────────────────────╮
│ Deployment Configuration │
├───────────────────────────────────────┤
│ Canary Deployment │
│ │
│ Service: news-api │
│ Version: v2.0.0 │
│ Environment: production │
│ Steps: 10,25,50,100 │
│ Metrics: 3 │
╰───────────────────────────────────────╯
✓ Deployment created: news-api-canary-20240101120000
Start: adaptive-deploy start --deployment news-api-canary-20240101120000
Create and optionally start a blue-green deployment.
adaptive-deploy blue-green deploy [OPTIONS]Required Options:
--service TEXT: Service name--version TEXT: Target version to deploy
Optional Parameters:
--environment [development|staging|production]: Target environment (default: staging)--namespace TEXT: Kubernetes namespace (default: default)--auto-start / --no-auto-start: Start deployment automatically (default: false)
Examples:
# Basic blue-green deployment
adaptive-deploy blue-green deploy \
--service news-api \
--version v2.0.0 \
--environment production
# With auto-start
adaptive-deploy blue-green deploy \
--service auth-service \
--version v1.5.2 \
--environment production \
--auto-startOutput:
╭───────────────────────────────────────╮
│ Deployment Configuration │
├───────────────────────────────────────┤
│ Blue-Green Deployment │
│ │
│ Service: news-api │
│ Version: v2.0.0 │
│ Environment: production │
╰───────────────────────────────────────╯
✓ Deployment created: news-api-blue_green-20240101120000
Start a pending deployment.
adaptive-deploy start --deployment DEPLOYMENT_IDRequired Options:
--deployment TEXT: Deployment ID
Examples:
adaptive-deploy start --deployment news-api-canary-20240101120000Output:
✓ Deployment started: in_progress
Pause a running deployment at the current step.
adaptive-deploy pause --deployment DEPLOYMENT_ID [--reason TEXT]Required Options:
--deployment TEXT: Deployment ID
Optional Parameters:
--reason TEXT: Reason for pausing
Examples:
# Pause deployment
adaptive-deploy pause --deployment news-api-canary-20240101120000
# Pause with reason
adaptive-deploy pause \
--deployment news-api-canary-20240101120000 \
--reason "Investigating error spike"Output:
✓ Deployment paused: paused
Resume a paused deployment.
adaptive-deploy resume --deployment DEPLOYMENT_IDRequired Options:
--deployment TEXT: Deployment ID
Examples:
adaptive-deploy resume --deployment news-api-canary-20240101120000Output:
✓ Deployment resumed: in_progress
Rollback a deployment to the previous version.
adaptive-deploy rollback --deployment DEPLOYMENT_ID [--reason TEXT]Required Options:
--deployment TEXT: Deployment ID--reason TEXT: Reason for rollback (prompted if not provided)
Examples:
# Interactive rollback
adaptive-deploy rollback --deployment news-api-canary-20240101120000
# Non-interactive rollback
adaptive-deploy rollback \
--deployment news-api-canary-20240101120000 \
--reason "High error rate detected"Output:
Are you sure you want to rollback news-api-canary-20240101120000? [y/N]: y
✓ Deployment rolled back: rolled_back
Get status of deployments.
adaptive-deploy status [OPTIONS]Options:
--deployment TEXT: Specific deployment ID--all: Show all deployments--service TEXT: Filter by service name--environment TEXT: Filter by environment--status TEXT: Filter by status
Examples:
# Get specific deployment status
adaptive-deploy status --deployment news-api-canary-20240101120000
# List all deployments
adaptive-deploy status --all
# Filter by service
adaptive-deploy status --service news-api
# Filter by multiple criteria
adaptive-deploy status \
--service news-api \
--environment production \
--status in_progressOutput (Specific Deployment):
╭──────────────────────────────────────────────────╮
│ Deployment Status │
├──────────────────────────────────────────────────┤
│ Deployment: news-api-canary-20240101120000 │
│ Service: news-api │
│ Status: in_progress │
│ Strategy: canary │
│ Traffic: 25% │
│ Version: v2.0.0 │
│ Environment: production │
╰──────────────────────────────────────────────────╯
Output (List):
Deployments
┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━┓
┃ ID ┃ Service ┃ Status ┃ Strategy ┃ Traffic ┃ Environment ┃
┡━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━┩
│ news-api-canary-... │ news-api │ in_progress │ canary │ 25% │ production │
│ auth-service-blue... │ auth-svc │ completed │ blue_... │ 100% │ staging │
└──────────────────────┴──────────┴─────────────┴──────────┴─────────┴─────────────┘
Total: 2 deployments
Check API server health.
adaptive-deploy healthExamples:
adaptive-deploy healthOutput:
╭──────────────────────────╮
│ API Health │
├──────────────────────────┤
│ Healthy │
│ │
│ Version: 1.0.0 │
│ Timestamp: 2024-01-01... │
╰──────────────────────────╯
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Authentication error |
| 3 | Not found |
| 4 | Invalid input |
| 5 | API error |
- name: Deploy with Adaptive Deploy CLI
run: |
pip install adaptive-deploy
adaptive-deploy login --username ${{ secrets.ADO_USERNAME }} --password ${{ secrets.ADO_PASSWORD }}
adaptive-deploy canary deploy \
--service ${{ github.event.repository.name }} \
--version ${{ github.sha }} \
--environment production \
--auto-startdeploy:
script:
- pip install adaptive-deploy
- adaptive-deploy login --username ${ADO_USERNAME} --password ${ADO_PASSWORD}
- |
adaptive-deploy canary deploy \
--service ${CI_PROJECT_NAME} \
--version ${CI_COMMIT_SHORT_SHA} \
--environment staging \
--auto-startstage('Deploy') {
steps {
sh '''
pip install adaptive-deploy
adaptive-deploy login --username ${ADO_USERNAME} --password ${ADO_PASSWORD}
adaptive-deploy canary deploy \
--service ${JOB_NAME} \
--version ${GIT_COMMIT} \
--environment production \
--auto-start
'''
}
}#!/bin/bash
set -e
# Deploy
DEPLOYMENT_ID=$(adaptive-deploy canary deploy \
--service news-api \
--version v2.0.0 \
--auto-start | grep -oP 'Deployment created: \K[^ ]+')
echo "Deployment ID: $DEPLOYMENT_ID"
# Monitor status
while true; do
STATUS=$(adaptive-deploy status --deployment $DEPLOYMENT_ID | grep -oP 'Status: \K[^ ]+')
echo "Current status: $STATUS"
if [ "$STATUS" == "completed" ]; then
echo "✓ Deployment successful"
exit 0
elif [ "$STATUS" == "failed" ] || [ "$STATUS" == "rolled_back" ]; then
echo "✗ Deployment failed"
exit 1
fi
sleep 30
done#!/bin/bash
SERVICES=("api" "web" "worker")
VERSION="v2.0.0"
for service in "${SERVICES[@]}"; do
echo "Deploying $service..."
adaptive-deploy canary deploy \
--service $service \
--version $VERSION \
--environment staging \
--auto-start
done# Verify API is accessible
curl http://localhost:8000/health
# Check credentials
adaptive-deploy login --username admin --password admin123
# Verify token
echo $ADO_TOKEN# Test API connectivity
curl -v http://localhost:8000/health
# Check API URL
echo $ADO_API_URL
# Try with explicit URL
adaptive-deploy --api-url http://localhost:8000 health# Verify installation
pip list | grep adaptive-deploy
# Reinstall
pip install -e cli/
# Check PATH
echo $PATH- Use Environment Variables: Store API URL and token in environment variables
- CI/CD Integration: Use
--auto-startfor automated deployments - Monitor Deployments: Always check status after deployment
- Graceful Rollbacks: Include
--reasonwhen rolling back - Security: Never commit tokens to version control
- Idempotency: Safe to re-run commands if connection is lost
- Logging: Capture CLI output for audit trails
adaptive-deploy canary deploy \
--service api \
--version v2.0.0 \
--metric error_rate:0.05 \
--metric latency_p99:1000 \
--metric latency_p95:500 \
--metric success_rate:0.99 \
--metric custom_metric:100# Very gradual rollout
adaptive-deploy canary deploy \
--service critical-api \
--version v2.0.0 \
--steps 1,5,10,25,50,75,100 \
--environment production# Create deployment (don't auto-start)
adaptive-deploy blue-green deploy \
--service api \
--version v2.0.0 \
--environment production
# Manually verify, then start
adaptive-deploy start --deployment <deployment-id>