Jenkins · Lesson 8 of 11 · 3 min read
Designing CI/CD with Jenkins
A reference flow
Enlarge diagram
Swipe sideways to see all of it, or tap to open it full screen.
On a pull request, Jenkins runs the checks, builds and scans the image, and reports a status back to GitHub. On a merge to main, it pushes the image tagged with the git SHA to ECR and updates the GitOps repo. Flux deploys to staging, a restricted approver promotes the same tag to production, and post-deploy checks can roll it back automatically.
Principles to state explicitly:
- Build once, promote the same artifact (same image digest) through environments — never rebuild for prod.
- Immutable, traceable versions — git SHA tags, never
latest. - Shift-left quality and security gates — unit tests, SonarQube quality gate (
waitForQualityGate), Trivy, dependency scanning, policy checks (conftest). - Separation of CI and CD in GitOps — Jenkins builds and updates Git; Flux (in the cluster) pulls and applies. Jenkins doesn't need cluster-admin credentials, which shrinks the blast radius if Jenkins is compromised.
- Fast feedback — PR builds under ~10 minutes; slower suites nightly.
- Notifications to the owning team (Slack) on failure, with links.
Enlarge diagram
Swipe sideways to see all of it, or tap to open it full screen.
Shared libraries as a platform product
With dozens of services, standardise pipelines in a shared library so each repo's Jenkinsfile is a few lines (standardPipeline(language: 'java', service: 'orders')). The platform team versions the library, tests it, and rolls improvements to every team — a central lever for security gates and consistency. (Covered in depth in the Groovy topic.)