iwantcoding.com
🔥 Daily 👥 Rooms 🏆 Top Log in Sign up

11.3 CI/CD

Continuous Integration merges code frequently and verifies it automatically. Continuous Deployment then ships it to production. Together they enable safe, fast changes.

11.3 CI/CD

CI - keeping the codebase always shippable

  • Trunk-based development; short-lived branches.
  • Pull request with required checks.
  • Automated tests on every push.
  • Static analysis (lint, SAST).
  • Build artefact stored; immutable.

Pipeline shape

Source Build Test Scan Staging Canary Prod git push compile unit + integ SAST + SCA smoke monitor SLO rollout Figure 11.3 - A safe CI/CD pipeline: build, verify, then progressively roll out.

CD - shipping it safely

StyleWhat is shipped
Continuous DeliveryAuto-deploys to staging; manual to prod
Continuous DeploymentEvery green main reaches production
Progressive deliveryCanary, blue-green, feature flags

Quality gates

GateTool examples
TestsUnit + integration + smoke
CoverageFloor on critical paths
SASTSemgrep, CodeQL
SCADependabot, Snyk
DASTOWASP ZAP
Container scanTrivy, Grype
PolicyOPA / Conftest for IaC

Rollback patterns

PatternMechanism
Blue-greenTwo stacks; switch traffic
CanarySmall % to new; auto-roll back on SLO breach
Feature flagToggle code path off without redeploy

Common pitfalls

  • Long-running branches; merge hell.
  • Pipelines slow; engineers bypass them.
  • No rollback plan; first incident is also the first rollback drill.
  • Secrets in plaintext in CI variables.
Mentor’s tip: Trunk + short branches + automated checks = CI. Canary + flags + auto-rollback = safe CD. Pipelines are audit artefacts in regulated industries; treat them with the same rigor as production code.

Test yourself

Q1. Continuous Integration primarily reduces:
Q2. A blue-green deployment lets you:
Q3. A canary release:
Q4. The DORA metric "lead time for changes" measures:
Q5. Which is NOT a CI/CD tool?

Discussion

Loading…