DevOps & Release Engineering¶
Grite integrates with CI/CD workflows and release processes.
Why Grite for DevOps?¶
- CI-friendly: Non-interactive CLI with JSON output
- Git-native: Fits existing git workflows
- Traceable: All changes in append-only log
- Coordinated: Distributed locks for deployments
CI Failure Tracking¶
Track CI failures and their resolution:
# CI system creates issue on failure
grite issue create --title "CI Failure: test_integration_auth [build #1234]" \
--body "$(cat <<'EOF'
## Build Info
- Build: #1234
- Branch: feature/oauth
- Commit: abc123
## Failure
## Logs
[Link to full logs]
EOF
)" --label "ci-failure" --label "test"
# Developer investigates and resolves
grite issue comment $ISSUE_ID --body "Flaky test - added retry logic"
grite issue close $ISSUE_ID
CI Integration Script¶
#!/bin/bash
# ci-failure-reporter.sh
if [ "$CI_STATUS" = "failed" ]; then
grite issue create \
--title "CI Failure: $CI_JOB_NAME [build #$CI_BUILD_NUMBER]" \
--body "Build: #$CI_BUILD_NUMBER
Branch: $CI_BRANCH
Commit: $CI_COMMIT
Error: $CI_ERROR_MESSAGE" \
--label "ci-failure" \
--json
grite sync --push
fi
Release Checklist Management¶
Track release checklist items that sync across the team:
grite issue create --title "Release v2.0.0 checklist" \
--body "$(cat <<'EOF'
## Pre-release
- [ ] All PRs merged
- [ ] Version bumped in Cargo.toml
- [ ] CHANGELOG.md updated
- [ ] Release notes drafted
- [ ] Security scan passed
## Release
- [ ] Tag created: v2.0.0
- [ ] Binaries built
- [ ] Docker images pushed
- [ ] GitHub release published
## Post-release
- [ ] Documentation site updated
- [ ] Announcement posted
- [ ] Monitor error rates for 24h
- [ ] Close release milestone
EOF
)" --label "release" --label "v2.0.0"
Release Workflow¶
# Start release
grite issue create --title "Release v2.0.0" --label "release"
grite lock acquire --resource "repo:release" --ttl 2h
# Update as you go
grite issue comment $RELEASE_ID --body "Tag created"
grite issue comment $RELEASE_ID --body "Binaries uploaded"
# Complete release
grite issue close $RELEASE_ID
grite lock release --resource "repo:release"
grite sync --push
Deployment Coordination¶
Track deployment readiness across environments:
grite issue create --title "Deploy v2.0.0 to production" \
--body "$(cat <<'EOF'
## Deployment Plan
### Stage 1: Staging
- [x] Deploy to staging
- [x] Run smoke tests
- [x] QA sign-off
### Stage 2: Canary
- [ ] Deploy to 5% of production
- [ ] Monitor metrics for 1h
- [ ] Verify no error spike
### Stage 3: Full Rollout
- [ ] Deploy to remaining 95%
- [ ] Monitor metrics for 4h
- [ ] Update status page
## Rollback Plan
If error rate >1%: `kubectl rollout undo deployment/api`
## Contacts
- Release lead: @alice
- On-call: @bob
EOF
)" --label "deployment" --label "production"
Deployment Lock¶
Prevent concurrent deployments:
# Acquire deployment lock
if ! grite lock acquire --resource "deploy:production" --ttl 1h; then
echo "Deployment already in progress"
exit 1
fi
# Deploy
./deploy.sh
# Release lock
grite lock release --resource "deploy:production"
Breaking Change Tracking¶
Track breaking changes and migration status:
grite issue create --title "Breaking change: API v1 deprecation" \
--body "$(cat <<'EOF'
## Change
API v1 endpoints will be removed in v3.0.0.
## Migration Guide
Replace `/api/v1/*` with `/api/v2/*`. See docs/migration-v2.md.
## Consumer Status
| Consumer | Status | Contact |
|----------|--------|---------|
| Mobile app | Migrated | @mobile-team |
| Partner A | In progress | [email protected] |
| Partner B | Not started | [email protected] |
| Internal dashboard | Migrated | @frontend |
## Timeline
- Deprecation notice: 2024-01-01
- Final warning: 2024-03-01
- Removal: 2024-04-01
EOF
)" --label "breaking-change" --label "api"
Feature Flag Coordination¶
Track feature flag states and ownership:
grite issue create --title "[Feature Flags] Active flags inventory" \
--body "$(cat <<'EOF'
## Active Feature Flags
| Flag | Purpose | Owner | Status |
|------|---------|-------|--------|
| `new_checkout_flow` | Redesigned checkout | @alice | 50% rollout |
| `dark_mode` | UI dark theme | @bob | 100% (ready to remove) |
| `experimental_search` | New search algorithm | @carol | Internal only |
| `rate_limit_v2` | New rate limiting | @dave | 10% rollout |
## Cleanup Queue
Flags at 100% for >30 days should be removed:
- [ ] `dark_mode` - remove flag, keep feature
- [ ] `new_login_page` - remove flag, keep feature
EOF
)" --label "feature-flags" --label "inventory"
Infrastructure Tracking¶
Track infrastructure changes:
grite issue create --title "Infra: Upgrade Kubernetes to 1.28" \
--body "$(cat <<'EOF'
## Reason
Security patches and new features needed.
## Plan
1. [ ] Update staging cluster
2. [ ] Run integration tests
3. [ ] Update production cluster (maintenance window)
## Rollback
kubectl can downgrade within 24h window.
## Dependencies
- [ ] Update kubectl locally
- [ ] Update CI runners
- [ ] Update helm charts
EOF
)" --label "infrastructure" --label "kubernetes"
On-Call Handoff¶
Document on-call status:
grite issue create --title "On-call handoff: Week of 2024-01-15" \
--body "$(cat <<'EOF'
## Outgoing: @alice
## Incoming: @bob
## Active Issues
1. Elevated error rate on /api/search - monitoring
2. Database slow queries - investigating
## Recent Incidents
- 2024-01-14: Brief API outage, resolved (see incident-123)
## Upcoming Maintenance
- 2024-01-17 02:00 UTC: Database maintenance window
## Notes
- Deploy freeze until 2024-01-18
- New runbook for auth issues: docs/runbooks/auth.md
EOF
)" --label "oncall" --label "handoff"
Monitoring Alerts¶
Track alert status:
grite issue create --title "Alert: High CPU on prod-api-3" \
--body "$(cat <<'EOF'
## Alert Details
- Host: prod-api-3
- Metric: CPU > 90% for 5m
- Started: 2024-01-15 14:30 UTC
## Investigation
- Checked recent deploys: none
- Checked traffic: normal
- Found: Runaway process in container
## Resolution
Restarted container, CPU normalized.
## Follow-up
- [ ] Add memory limits to container spec
- [ ] Create alert for container restarts
EOF
)" --label "alert" --label "resolved"
CI/CD Pipeline Integration¶
GitHub Actions Example¶
- name: Report CI Failure
if: failure()
run: |
grite issue create \
--title "CI Failure: ${{ github.job }} [#${{ github.run_number }}]" \
--body "Workflow: ${{ github.workflow }}
Branch: ${{ github.ref_name }}
Commit: ${{ github.sha }}
Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
--label "ci-failure" \
--json
grite sync --push
GitLab CI Example¶
report_failure:
stage: .post
when: on_failure
script:
- grite issue create --title "CI Failure: $CI_JOB_NAME" --label "ci-failure"
- grite sync --push
Best Practices¶
Use Locks for Critical Operations¶
# Deployment
grite lock acquire --resource "deploy:$ENV" --ttl 1h
# Database migrations
grite lock acquire --resource "migration:$DB" --ttl 30m
# Release creation
grite lock acquire --resource "repo:release" --ttl 2h
Automate Issue Creation¶
Integrate with your CI/CD to create issues automatically:
- On build failure
- On deployment start/complete
- On alert firing
Keep Issues Updated¶
# Deployment progress
grite issue comment $DEPLOY_ID --body "Canary at 5%"
grite issue comment $DEPLOY_ID --body "Canary healthy, proceeding to 100%"
grite issue comment $DEPLOY_ID --body "Deployment complete"
grite issue close $DEPLOY_ID
Archive Old Issues¶
# Monthly cleanup
grite issue list --state closed --label "ci-failure" | \
xargs -I {} grite issue label add {} --label "archived"
Next Steps¶
- Distributed Locks - Deployment coordination
- CLI Reference - CI automation
- JSON Output - Parsing in scripts