CI/CD je základní praktika moderního vývoje. Automatizujte všechno.
CI — Continuous Integration¶
Každý push → build → test → feedback. Cíl: najít chyby co nejdříve.
- Automatický build při každém push
- Unit + integration testy
- Linting a static analysis
- Security scanning
CD — Continuous Delivery vs Deployment¶
Delivery: kód je vždy připraven k deployi (manuální schválení). Deployment: automatický deploy po testech.
GitHub Actions příklad¶
name: CI/CD
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm test
deploy:
needs: test
if: github.ref == ‘refs/heads/main’
runs-on: ubuntu-latest
steps:
- run: deploy.sh
Deployment strategie¶
- Rolling — postupná výměna instancí
- Blue/Green — dvě identické prostředí, switch
- Canary — 5% traffic na novou verzi, sledujte metriky
- Feature flags — deploy code, toggle feature
Nástroje¶
- GitHub Actions, GitLab CI, CircleCI
- ArgoCD (GitOps pro K8s)
- Jenkins (enterprise legacy)
- Tekton (cloud-native)
DORA metriky¶
- Deployment frequency
- Lead time for changes
- Mean time to recovery (MTTR)
- Change failure rate
Cíl¶
Deploy do produkce by měl být nudný, rutinní, bezrizikový. Pokud vás deploy stresuje, potřebujete lepší CI/CD.