Easy CI/CD: Automating Deploys with Git Workflow & Jenkins
A clean CI/CD pipeline makes deployments safe and fast. GitHub Actions/GitLab CI vs Jenkins, plus the patterns I use to deploy to Kubernetes.
Manual deploys are risky: it is easy to forget a step, environments differ, and rollbacks are hard. From experience, a clean CI/CD pipeline makes deployments fast, consistent, and safe. Here is a comparison of the two approaches I use most often.
CI/CD with Git Workflow
With GitHub Actions or GitLab CI, the pipeline is defined as code (YAML) inside the repo. Every push or merge automatically triggers the flow: build, test, then deploy.
name: deploy
on:
push:
branches: [main]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: docker build -t registry/app:${GITHUB_SHA} .
- run: docker push registry/app:${GITHUB_SHA}
- run: kubectl set image deployment/app app=registry/app:${GITHUB_SHA}
The advantages:
- Pipeline as code — version-controlled and easy to review.
- Integrated with the repo — no separate server needed.
- Large ecosystem — thousands of ready-made actions.
CI/CD with Jenkins
Jenkins suits enterprise or on-premise environments that need full control and specific plugins. The pipeline is written in a Jenkinsfile.
The advantages:
- Flexible and mature — plugins for almost every need.
- Self-hosted — a good fit for strict security policies.
- Great for complex pipelines with many stages and approval steps.
The trade-off: Jenkins needs its own server maintenance — updates, plugins, and security.
Integration with Kubernetes
Whatever the tool, the pattern is similar for deploying to Kubernetes:
- Build the image and push it to a container registry.
- Update the manifest, or
kubectl set image, or go through GitOps (ArgoCD/Flux). - Kubernetes performs a rolling update with zero downtime.
For serious teams, I usually steer toward GitOps: all manifests live in Git, and ArgoCD keeps the cluster in sync declaratively. Git becomes the single source of truth.
Best Practices
- Store credentials in a secret manager, not in the pipeline.
- Separate environments (staging then production) with approval steps.
- Always have a fast rollback path ready.
- Run automated tests before deploying.
Conclusion
Git workflow wins on simplicity and integration; Jenkins wins on flexibility and control. Combined with Kubernetes and GitOps, both make deployment a safe, predictable, one-click affair.
Want to set up a CI/CD pipeline or GitOps for your team? Get in touch.