Stop 06 · CI/CD PipelinesProjects · 1/1

Build a Full CI/CD Pipeline for a Sample App

Part of the DevOps Roadmap

In short

Time to wire everything from this phase into one pipeline you can show in interviews: a push to main tests, builds, stores and deploys your app with nobody touching a server.

The practice project for this phase — take a small sample application from commit through automated build, test, and deployment, wiring the full pipeline together end to end.

The mascot on a delivery scooter rides along a winding road past a kitchen, a parcel stop and a house door.

Think of it like this

Tracking a food delivery order

Your delivery app shows each step: order placed, restaurant cooking, picked up, on the way, delivered. If it stalls, you see exactly where. Your pipeline should feel the same: every stage visible, each one gated on the last, and you know where it stopped.

Watch it happen

Your build plan, stage by stage

Test
Build image
Push
Staging
Approve
Production

1/6Every push and PR runs lint and unit tests. A failure stops everything after it.

The big ideas

What you need to know

Tests gate everything

No image gets built unless tests pass. That's the safety net the rest of the pipeline relies on.

Immutable tags

Tag images with the commit SHA and deploy that same tag everywhere. No latest.

Secrets done right

Registry and server credentials live in the secret store or come from OIDC. Nothing in the YAML.

A rollback plan

Write down how to redeploy the previous tag. Even better, make it one pipeline run.

See it in code

Walk through the code

yaml
1name: pipeline2on:3  push:4    branches: [main]5jobs:6  test:7    runs-on: ubuntu-latest8    steps:9      - uses: actions/checkout@v410      - run: npm ci && npm test11  image:12    needs: test13    runs-on: ubuntu-latest14    steps:15      - uses: actions/checkout@v416      - run: docker build -t ghcr.io/your-name/sample-app:${{ github.sha }} .

1/4Run the whole pipeline on every push to main.

This is the skeleton. Next, add a registry login and push step, then staging and production deploy jobs that each need the job before them.

Save yourself the pain

Common mistakes

Oops

Building one giant job that does test, build and deploy in a single script.

Do this instead

Split into jobs with needs:. You see exactly which stage failed and can rerun just that one.

Oops

Deploying to production straight from every push with no check after deploy.

Do this instead

Add a staging step, a smoke test and an approval gate before production. Then check /health after deploying.

Your mission

Milestone 1: green to staging

~45 min

Quick check

In GitHub Actions, what does needs: test on the image job do?

Go deeper

  1. 1Choose a small sample app (even a 'hello world' service) to keep focus on the pipeline itself.
  2. 2Include build, automated tests, and a deployment step to somewhere real (even a free-tier host).
  3. 3Document your pipeline's stages in a README so someone else could understand it at a glance.

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge