Khi bạn push code lên remote (Git server) thì pipeline (CI/CD) sẽ chạy theo flow chuẩn như sau:
Ví dụ:
git add . git commit -m "update feature" git push origin main
Code được đẩy lên remote như:
Remote repo có cấu hình CI/CD:
Khi nhận được push event → hệ thống tạo 1 pipeline run mới.
Pipeline không tự chạy.
Nó cần:
Runner có thể nằm:
Ví dụ:
| Platform | File cấu hình |
|---|---|
| GitHub | .github/workflows/*.yml |
| GitLab | .gitlab-ci.yml |
| Jenkins | Jenkinsfile |
Ví dụ pipeline thường gồm:
stages: - build - test - deploy
Ví dụ thực tế:
Bạn có thể:
Vì bạn hay dùng:
Pipeline thường sẽ:
Push main
→ Run test
→ Build assets
→ SSH vào VPS
→ git pull
→ clear cache
→ reload php-fpm
Hoặc nếu xịn hơn:
Push
→ Build Docker image
→ Push lên registry
→ Server pull image mới
→ Zero-downtime deploy
Push → Trigger webhook → CI server tạo pipeline → Runner chạy script → Deploy