Pipeline stages
- Maven build + unit tests
- Docker image build (multi-stage — builder + runtime image)
- Push to ECR with semantic version tag and
latest - ECS blue/green deployment using CodeDeploy
- Smoke tests against the new task set
- Shift traffic 100% → old task set teardown
Blue/green on ECS
ECS + CodeDeploy handles the routing shift. The key is the appspec.yaml and the lifecycle hook for smoke tests before traffic cutover. If the hook fails, CodeDeploy rolls back automatically.
Build time
Initial naive pipeline: 18 minutes. After parallelizing test stages and caching Maven dependencies in an EFS-mounted directory shared across Jenkins agents: 6 minutes.
What I'd change
Maven caching on EFS works but it's fragile — cache corruption causes mysterious build failures. Docker layer caching with a proper registry cache (BuildKit + --cache-from) is cleaner. Replaced it a year later when the team migrated to GitLab CI.