C.W.K.
Stream
Lesson 06 of 12 · published

Pipeline Anatomy

~14 min · anatomy, stages, gates

Level 0Apprentice
0 XP0/101 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

Stages, gates, environments

A pipeline is not just 'a script that runs on push'. It is a directed graph of stages, separated by gates, ending at one or more environments.

The classic anatomy:

  • Source — checkout. The exact commit being processed.
  • Build — compile, bundle, containerize. Output is an artifact — a deterministic, named, immutable thing.
  • Test — unit, integration, acceptance. Often parallelized.
  • Static analysis — lint, type-check, security scan, license scan.
  • Package — assemble the artifact for deploy (Docker image, npm tarball, wheel).
  • Deploy → staging — usually automatic.
  • Acceptance / smoke tests against staging.
  • Deploy → production — Delivery: gated by approval. Deployment: automatic.
  • Post-deploy verification — smoke tests against prod, observability checks.

Not every project needs every stage. A static site can collapse build/package/deploy into one. A regulated bank app might add 5 more (compliance scan, change advisory board approval, audit log emission). The shape is always a graph of gates around an artifact.

Code

Two-environment pipeline (staging → production)·yaml
name: pipeline
on: { push: { branches: [main] } }
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: ./build.sh
      - uses: actions/upload-artifact@v4
        with: { name: dist, path: dist/ }

  test:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: ./test.sh

  deploy-staging:
    needs: [build, test]
    runs-on: ubuntu-latest
    environment: staging
    steps:
      - uses: actions/download-artifact@v4
        with: { name: dist }
      - run: ./deploy.sh staging

  deploy-prod:
    needs: deploy-staging
    runs-on: ubuntu-latest
    environment: production    # gated
    steps:
      - uses: actions/download-artifact@v4
        with: { name: dist }
      - run: ./deploy.sh prod

External links

Exercise

Sketch your current project's pipeline as a graph. Mark each stage, each gate (manual or automatic), and each environment. If staging and production rebuild the artifact separately, mark it as a 'build once' violation and write down what you'd change.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.