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
- Test and build: Project 04.
- Security scan: stop known-vulnerable packages before they ship.
- Build the image and tag it with the version and commit ID.
- Push it to a registry. From here on, every environment runs this exact image: build once, deploy many times.
- Deploy to staging and run smoke tests: a few quick checks that the app starts and its key pages respond.
- Approval gate (for continuous delivery): a person clicks approve.
- Deploy to production.
- 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.
Staging
notes-app:v1.3.2
Production
notes-app: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.
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
Key terms
Say the meaning to yourself, then tap a card to check.
Quiz score: 0 of 3
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.