Menu

CI CD And DevOps Basics

Learn CI CD And DevOps Basics for Backend Engineer for free: roadmap, examples, subskills, and a skill exam.

Published: January 20, 2026 | Updated: January 20, 2026

Why this skill matters for Backend Engineers

CI/CD and DevOps practices help you deliver backend services faster and safer. You automate builds, tests, container images, deployments, and rollbacks. This reduces manual errors, shortens feedback loops, and lets you ship features with confidence.

  • Speed: Every commit is validated automatically.
  • Reliability: Tests, quality checks, and deployment gates catch issues early.
  • Repeatability: Containers and scripts make environments predictable.
  • Recovery: Rollbacks and feature flags reduce downtime and blast radius.

What you'll be able to do

  • Design basic pipelines that build, test, scan, and package a service.
  • Containerize a backend and push images to a registry.
  • Deploy to staging and production with safe rollbacks.
  • Manage environment configs and secrets securely.
  • Use feature flags to release gradually.
  • Read and contribute to Infrastructure-as-Code changes.

Prerequisites

  • Comfort with a backend language (e.g., Java, Go, Python, Node.js).
  • Basic Git usage (commit, push, pull, merge).
  • Command line basics and reading YAML.

Learning path

  1. 1) Git and branching habits

    Adopt short-lived branches, small PRs, and protected main branch. Practice rebasing and resolving conflicts cleanly.

    Mini task
    • Create a feature branch, commit twice, rebase on main, and open a PR/MR.
  2. 2) CI basics: build + test on every push

    Add a pipeline that runs unit tests and lints your code. Fail fast when tests fail.

    Mini task
    • Configure a CI workflow to run tests on pushes and pull requests.
  3. 3) Artifacts and caching

    Cache dependencies to speed builds. Store build artifacts (binaries, coverage reports) for later stages.

    Mini task
    • Add dependency cache and upload a test report artifact.
  4. 4) Containerization

    Write a lean Dockerfile (multi-stage where possible). Scan for vulnerabilities and push to a registry.

    Mini task
    • Build an image locally, run tests inside the container, and push to a registry.
  5. 5) Release pipeline and environments

    Model staging and production with approvals. Promote artifacts instead of rebuilding.

    Mini task
    • Create separate jobs for staging and production using the same image artifact.
  6. 6) Configuration and secrets

    Keep configs out of code. Use environment variables and secret stores. Template config by environment.

    Mini task
    • Parameterize DB URL and API keys via environment variables in your pipeline.
  7. 7) Deployments and rollbacks

    Automate deploys. Support blue/green or canary. Ensure a quick rollback path.

    Mini task
    • Script a rollback command that re-deploys the previous stable image.
  8. 8) Feature flags

    Wrap risky changes with flags. Gradually enable, and keep a kill switch.

    Mini task
    • Guard a new endpoint or code path behind a feature flag variable.
  9. 9) IaC awareness

    Understand Terraform/Cloud templates. Review changes, plans, and state handling.

    Mini task
    • Review a Terraform plan and identify what resources will change.

Worked examples

1) Simple CI pipeline that builds and tests
# Example: GitHub Actions workflow (build + test)
name: ci
on:
  push:
  pull_request:
jobs:
  build-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Setup Node
        uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'npm'
      - run: npm ci
      - run: npm test -- --ci --reporters=default --reporters=junit
      - name: Upload test report
        uses: actions/upload-artifact@v4
        with:
          name: junit-report
          path: ./junit.xml

Notes: cache dependencies, fail on tests, and upload reports for visibility.

2) Multi-stage Dockerfile for a backend API
# Dockerfile (Node.js example)
FROM node:20-alpine AS deps
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production

FROM node:20-alpine AS builder
WORKDIR /app
COPY . .
RUN npm ci && npm run build

FROM node:20-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
COPY --from=deps /app/node_modules ./node_modules
COPY --from=builder /app/dist ./dist
EXPOSE 3000
CMD ["node", "dist/server.js"]

Notes: smaller final image, faster cold starts, fewer vulnerabilities.

3) Release pipeline with staging then production
# Example: GitHub Actions release with environments
name: release
on:
  workflow_dispatch:
  push:
    tags:
      - 'v*.*.*'
jobs:
  build-image:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Build image
        run: docker build -t ghcr.io/org/service:${{ github.sha }} .
      - name: Push image
        run: |
          echo $CR_PAT | docker login ghcr.io -u USER --password-stdin
          docker push ghcr.io/org/service:${{ github.sha }}
    outputs:
      image: ghcr.io/org/service:${{ github.sha }}

  deploy-staging:
    needs: build-image
    runs-on: ubuntu-latest
    environment: staging
    steps:
      - name: Deploy to staging
        run: ./scripts/deploy.sh ${{ needs.build-image.outputs.image }} staging

  deploy-production:
    needs: deploy-staging
    runs-on: ubuntu-latest
    environment: production
    steps:
      - name: Deploy to production
        run: ./scripts/deploy.sh ${{ needs.build-image.outputs.image }} production

Notes: promote the same image artifact; environments can enforce approvals.

4) Fast rollback using deployment history (Kubernetes)
# Roll forward or back quickly
# See current history
kubectl rollout history deployment api

# Roll back to previous revision
kubectl rollout undo deployment api

# Verify status
kubectl rollout status deployment api --timeout=120s

Notes: keep images tagged (e.g., commit SHA) so you can revert deterministically.

5) Feature flag guard in code
# Example: Python
import os
FEATURE_NEW_ENDPOINT = os.getenv("FEATURE_NEW_ENDPOINT", "false").lower() == "true"

def get_widget(id):
    if FEATURE_NEW_ENDPOINT:
        return get_widget_v2(id)  # new logic
    return get_widget_v1(id)      # stable logic

Notes: use environment-controlled flags; default to safe behavior.

Drills and exercises

Common mistakes and debugging tips

Rebuilding images for each environment

Symptom: staging and prod run slightly different images. Fix: build once, tag immutably (commit SHA), and promote the same artifact.

Secrets checked into code

Symptom: API keys in repo history. Fix: rotate keys, purge history, and use secret stores or CI secret management. Inject via env vars.

Flaky tests breaking the pipeline

Symptom: intermittent failures. Fix: isolate tests, seed randomness, add retries sparingly, and quarantine known flakies until fixed.

Slow pipelines

Symptom: long feedback loops. Fix: cache dependencies, parallelize jobs, run unit tests first, and move heavy steps after fast checks.

No rollback strategy

Symptom: hotfixes require urgent rebuilds. Fix: keep previous images; script a rollback command using deployment history or last-good tag.

Mixing environment config with code

Symptom: branches per environment. Fix: externalize config; template or use per-environment variables.

Mini project: CI/CD for a demo REST API

Goal: Implement end-to-end CI/CD for a small API with safe deploys and quick rollbacks.

  1. CI: On push/PR, run lint and unit tests; cache dependencies; upload reports.
  2. Image: Build a multi-stage Docker image; scan or at least keep size small; push with immutable tag.
  3. Staging deploy: Deploy the built image; run a smoke test after deploy.
  4. Production deploy: Manual approval gate; deploy the same image; notify on success/failure.
  5. Config: Use environment variables for DB URL and feature flags; inject secrets from CI.
  6. Rollback: Script a one-command rollback to the last successful image tag.
Acceptance criteria checklist

Subskills

Each subskill below focuses on one capability you'll practice in this skill.

  • Git And Branching — Work with feature branches, rebases/merges, and protected main.
  • Automated Testing In CI — Run tests and quality checks automatically on each change.
  • Build And Release Pipelines — Model multi-stage workflows, artifacts, and promotions.
  • Containerization Basics — Build efficient images and use registries safely.
  • Deployments And Rollbacks — Automate deploys and recover fast with rollbacks.
  • Environment Configuration — Externalize config and handle secrets securely.
  • Feature Flags Basics — Ship safely with toggles and gradual rollout.
  • Infrastructure As Code Awareness — Read and review Terraform/Cloud templates.

Next steps

  • Harden your pipelines with security scans (SCA/SAST), image signing, and policy checks.
  • Add canary or blue/green to reduce risk further and measure impact.
  • Expand observability: logs, metrics, and alerts for each environment.
  • Practice incident response: document rollback steps and run game days.

CI CD And DevOps Basics — Skill Exam

This exam checks your practical understanding of CI/CD and DevOps for backend services. Everyone can take it for free. If you are logged in, your progress and results will be saved automatically.Estimated time: 20–30 minutesPassing score: 70%Open book: you can consult notes and your codeTip: read all options carefully; some questions have multiple correct answers

12 questions70% to pass

Have questions about CI CD And DevOps Basics?

AI Assistant

Ask questions about this tool