CI/CD Concepts and Pipeline Design

Learn continuous integration, delivery and deployment, pipeline stages, artifacts and environment promotion.

Intermediate · about 3 hours · difficulty 2/5

Learn first: Git and GitHub for Infrastructure Work

Continuous Integration (CI) means every change is built and tested automatically when pushed. Continuous Delivery keeps the main branch always deployable; Continuous Deployment goes further and releases every passing change to production automatically.

A typical cloud pipeline

  1. Trigger on a pull request or merge to main.
  2. Build: compile, install dependencies, build a container image.
  3. Test: unit tests, linting, security scans (dependencies, IaC, container images).
  4. Package: push a versioned artifact (image to ECR, zip to S3) tagged with the Git commit SHA.
  5. Deploy to dev/staging, run smoke tests.
  6. Promote the same artifact to production, sometimes after a manual approval.

Principles

  • Build once, deploy many: never rebuild for production; promote the tested artifact.
  • Fast feedback: keep CI under about ten minutes.
  • Infrastructure pipelines too: run terraform plan or cdk diff on pull requests and apply on merge.
  • Short-lived credentials: pipelines assume IAM roles through OIDC instead of storing access keys.

Measuring delivery

The DORA metrics (deployment frequency, lead time for changes, change failure rate, time to restore) are how teams measure how good their delivery is.

Pitfalls

  • Flaky tests that everyone learns to ignore.
  • Different artifacts in staging and production.
  • Pipelines with AdministratorAccess when they only need to update one service.

You are ready to move on when you can draw the stages of a pipeline for a containerized app and explain why the same image should move from staging to production.

Key concepts

  • CI vs continuous delivery vs deployment
  • Pipeline stages
  • Artifacts and versioning
  • Build once, deploy many
  • Environment promotion and approvals
  • Security scanning in pipelines
  • DORA metrics

Mini project

Draw the full pipeline for your containerized API: triggers, stages, where tests and scans run, which IAM role each stage uses, and how an artifact moves from dev to prod. Commit the diagram to your repo. No cloud cost.

Check yourself

Why is rebuilding the Docker image separately for production a risk, even from the same commit?

Free resources