CI/CD Deploy Helper
Standardized deployment automation for CI/CD pipelines (GitHub Actions, GitLab CI, Jenkins).
Features
- Docker image build and push
- Kubernetes manifest templating (kustomize-style)
- Database migration runner
- Environment-specific config generation
- Deployment health check and rollback
- Slack/Teams/DingTalk notifications
Usage
# Build and push Docker image
python scripts/deploy.py --action build --tag v1.2.3 --registry harbor.example.com
# Run database migrations
python scripts/deploy.py --action migrate --env staging --db-url $DATABASE_URL
# Deploy to Kubernetes
python scripts/deploy.py --action k8s-deploy --env production --namespace default
# Run health check after deploy
python scripts/deploy.py --action healthcheck --url https://api.example.com/health
# Send deployment notification
python scripts/deploy.py --action notify --status success --env production
Configuration
Deployment config is read from deploy.yaml in the project root:
environments:
staging:
registry: harbor-dev.example.com
k8s_namespace: staging
db_url_env: STAGING_DATABASE_URL
production:
registry: harbor.example.com
k8s_namespace: production
db_url_env: DATABASE_URL
Safety
- Always runs a dry-run first (set
--no-dry-runto actually deploy) - Requires explicit environment confirmation for production
- Automatic rollback on health check failure

