Skip to content
Ameen Abozaid
MID-055

CI/CD advanced

  • 6 Lessons
  • 2.5 h practice (estimate)
On this page 8 topics

Overview

Topics

  • Deployment environments
  • automated quality gates
  • rollback

Learn first

2.5 h of practice (estimate)

Learning outcomes

  1. Promote one immutable artifact through environments (dev, staging, production).
  2. Add automated quality gates (tests, contracts, coverage thresholds, security scans).
  3. Implement blue-green or rolling deployments with automated rollback on failed checks.
  4. Use feature flags to separate deployment from release.

Lessons

  1. 01Build once, promote everywhere
  2. 02Environments and approvals
  3. 03Quality gates
  4. 04Deployment strategies
  5. 05Feature flags
  6. 06Demo: an automated rollback on a failed health check

Lab and exercises

Lab

MID-055-LAB1 · Promotion pipeline

Outcomes: 1–4 · Time: ~3 h Build a pipeline for Shop services: build one image, deploy to dev, then staging with gates (tests, contracts, scans, coverage threshold), then production with approval. Use a rolling or blue-green strategy with a post-deploy smoke check and automatic rollback. Put one new feature behind a flag. Acceptance: a deliberately broken release is rolled back without human action.

Exercises (assessment: pipeline review)

IDOutcomeTask
MID-055-EX011Review a pipeline that builds a separate image per environment. List the problems and the fix.
MID-055-EX022Choose gates for orders and order them by speed; state what blocks a merge versus a deployment.
MID-055-EX033Compare rolling, blue-green, and canary for the payments service; pick one with reasons.
MID-055-EX043Plan a database column rename so that a rollback stays safe.
MID-055-EX054Put a new discount rule behind a flag; define rollout stages and the removal date.
MID-055-EX061List the manual production steps in a given runbook and automate two of them.
Show solutions
  • EX01 Rebuilds can differ from the tested artifact and are slower; build once, tag by SHA, promote by digest, configure per environment.
  • EX02 Fast first: lint and unit tests, then integration and contract tests, then scans. Merge gates: tests, contracts, scans. Deployment gates: smoke tests and SLO check.
  • EX03 For payments, blue-green or canary with automatic rollback to limit exposure; rolling is acceptable if the change is backward compatible and probes are good.
  • EX04 Expand and contract: add the new column, write to both, migrate, switch reads, drop the old column in a later release.
  • EX05 Flag default off; staff, then 5%, 25%, 100% watching error rate; remove the flag and the old path within a set period.
  • EX06 Example: manual database migrations and smoke tests become pipeline jobs; approval remains only for the production gate.

Outcome 4 is also covered by quiz Q09–Q10; outcomes 1–3 by the lab and the pipeline review.

Quiz

Outcomes: O1 build once, promote · O2 quality gates · O3 deployment strategies and rollback · O4 feature flags.

A self-check for you: nothing is graded, saved or sent anywhere. Choose an answer, then check it. You can try again as often as you like.

  1. 1"Build once, promote everywhere" means:O1
  2. 2Environments should differ by:O1
  3. 3A good quality gate is:O2
  4. 4Why avoid chasing 100% coverage?O2
  5. 5In blue-green deployment you roll back by:O3
  6. 6A canary release:O3
  7. 7Safe rollback requires the database schema to be:O3
  8. 8A readiness probe that always returns 200:O3
  9. 9Feature flags separate:O4
  10. 10Release flags should be:O4

Practical part

Pipeline review (MID-055-EX01) plus lab MID-055-LAB1. Pass: quiz at least 8/10, a pipeline promoting one artifact through two environments with gates, and a broken release rolled back automatically.

Common mistakes

Rebuilding per environment; manual production steps; flags never removed.

Assessment

Pipeline review.

Career relevance

Large migrations (SRB-017) and engineering productivity (STF-009).

Type to search levels, phases, modules and lessons.