Module 5 · Project 05 · Build a Complete CI/CD Pipeline · Lesson 18 of 48

From push to production: the delivery pipeline

Continuous delivery vs deployment, and every stage of a pipeline that tests, scans, packages, deploys and verifies.

In this lesson · about 30 minutes

  • Tell continuous delivery from continuous deployment
  • Describe each stage from test to health check, and why it's there
  • Write a deploy job that builds, tags, pushes and deploys an image

CI, then CD

Project 04 stopped at a tested build. CD carries it the rest of the way:

  • Continuous delivery: every change that passes is ready to release, and releasing is one click or one approval.
  • Continuous deployment: every change that passes goes to production automatically, with no human step.

Most teams start with delivery and move toward deployment as their tests and monitoring earn their trust.

The stages, and why each exists

  1. Test and build: Project 04.
  2. Security scan: stop known-vulnerable packages before they ship.
  3. Build the image and tag it with the version and commit ID.
  4. Push it to a registry. From here on, every environment runs this exact image: build once, deploy many times.
  5. Deploy to staging and run smoke tests: a few quick checks that the app starts and its key pages respond.
  6. Approval gate (for continuous delivery): a person clicks approve.
  7. Deploy to production.
  8. Verify: health check and error rates. If it fails, roll back to the previous image.

Try it · watch it run

From git push to production

Step through a release of v1.4.0. Then switch on a critical vulnerability, or a version that's broken in production, and see where the pipeline stops.

Tests→
Build→
Security scan→
Docker build + tag→
Push to registry→
Deploy to staging→
Staging health check→
Approval gate→
Deploy to production→
Production health check

Staging

notes-app:v1.3.2

Production

notes-app:v1.3.2

Step 1 of 12A developer merges a change to main. The pipeline starts automatically. Production runs v1.3.2.

What the deploy part looks like

  deliver:
    needs: [build]
    runs-on: ubuntu-latest
    permissions: { contents: read, packages: write }
    steps:
      - uses: actions/checkout@v4
      - name: Log in to the registry
        uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - name: Build and push
        uses: docker/build-push-action@v6
        with:
          push: true
          tags: |
            ghcr.io/you/notes-app:${{ github.sha }}
            ghcr.io/you/notes-app:1.4.0
      - name: Scan the image
        uses: aquasecurity/trivy-action@0.28.0
        with:
          image-ref: ghcr.io/you/notes-app:${{ github.sha }}
          severity: CRITICAL,HIGH
          exit-code: "1"                 # fail the job on findings

  deploy-staging:
    needs: [deliver]
    environment: staging
    runs-on: ubuntu-latest
    steps:
      - run: ./deploy.sh staging ${{ github.sha }}
      - run: curl -fsS --retry 10 --retry-delay 3 https://staging.notes.example/health

The deploy script can be as simple as SSH to a server, docker pull the new tag and restart with Compose; or a cloud command for a container service (on AWS, ECS or App Runner); or, from Project 07, a Kubernetes update. The pipeline doesn't care: it only needs a command that deploys a given image tag and exits non-zero if it fails.

curl -f fails on HTTP errors, and --retry gives the new version a few seconds to start. That one line is your first automated health check.

Whiteboard · watch and try

Build once, deploy many

Press Play to see why the same image goes everywhere.

4 steps
Press Play and the tutor will talk you through it while writing on the board. Pause any time to write on the board yourself.

Tip: press Pause, then use the pen to work along on the board. Space plays and pauses; Ctrl+Z undoes your last mark.

Check your understanding0 of 3 correct

Question 1

1.What separates continuous delivery from continuous deployment?

Question 2

2.Why tag images with the commit ID?

Question 3

3.The image scan finds a CRITICAL vulnerability. What should the pipeline do?

Key terms

Say the meaning to yourself, then tap a card to check.

Quiz score: 0 of 3

Tip: answer every quiz question correctly first.

Written by Noviq Academy in its own words. The labs are simulations: no real servers are touched. When you build the projects yourself, use a practice virtual machine or a free-tier cloud account you control, watch your cloud spending, and never run cleanup or delete commands on a machine you care about. Tool names belong to their owners; versions and output are shown for learning and may differ slightly from yours. Read-aloud and the whiteboard voice use your device's built-in voices.