Aşağıdaki proje için CI/CD pipeline tasarla:
PROJE:
- Tip: [WEB APP / MOBİL / API / MONOREPO / MİKROSERVİS]
- Dil/framework: [REACT / NODE / PYTHON / JAVA / GO / DİĞER]
- Hosting: [AWS / GCP / AZURE / VPS / VERCEL / DİĞER]
- Ekip: [N KİŞİ]
- Mevcut: [YOK / TEMEL / GELİŞMİŞ]
ÜRET:
1. CI (CONTINUOUS INTEGRATION):
Trigger: push to main/develop, PR açılması
AŞAMALAR:
- Checkout: kodu çek
- Install: bağımlılık yükle (cache kullan — node_modules, pip cache)
- Lint: kod kalite kontrolü
- Build: derleme (TypeScript, webpack, Docker image)
- Test: unit + integration (paralel çalıştır)
- Coverage: %80+ threshold
- Security: dependency scan (npm audit, Snyk), SAST
- Artifact: build çıktısını sakla
2. CD (CONTINUOUS DEPLOYMENT):
STRATEJİ:
- Staging: develop branch → otomatik deploy → QA
- Production: main branch → manual approval → deploy
DEPLOY YÖNTEMLERİ:
- Blue-green: 2 ortam, trafik switch
- Canary: %5 → %25 → %100 kademeli
- Rolling: pod pod güncelleme (K8s)
- Feature flag: kod deploy ama özellik kapalı
3. ORTAMLAR:
- Development (local)
- Staging (test — production mirror)
- Production
- Her ortam: ayrı config, ayrı DB, ayrı secret
4. ARAÇLAR:
- GitHub Actions (YAML workflow)
- GitLab CI/CD
- Jenkins (self-hosted)
- ArgoCD (GitOps, K8s)
- Terraform (IaC — infrastructure as code)
5. DOCKER:
- Multi-stage Dockerfile (build + runtime ayrı)
- Image tagging (git SHA, semantic version)
- Registry: ECR / GCR / Docker Hub
- Image scanning (Trivy)
6. MONITORING (deploy sonrası):
- Health check endpoint
- Rollback otomasyonu (error rate spike → eski versiyona dön)
- Deploy notification (Slack)
- Changelog otomatik oluşturma
7. ÖRNEK GITHUB ACTIONS WORKFLOW:
```yaml
name: CI/CD
on:
push: {branches: [main, develop]}
pull_request: {branches: [main]}
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm ci
- run: npm run lint
- run: npm test -- --coverage
deploy:
needs: test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- run: # deploy commands
```
Türkçe, DevOps best practice.