CI/CD

Pipelines & DevOps

Interactive pipeline simulator + 35 concept cards + 35 interview Q&As. Click ▶ Run Pipeline to start.

The Big Picture — How CI/CD Works

Without CI/CD — Manual ProcessRisky

1. Developer writes code

tested only locally

2. Manual build on dev machine

different env than production

3. Tests run manually (if at all)

often skipped under pressure

4. Zip + FTP to server

no rollback, no audit trail

5. Cross fingers & pray 🙏

unknown state in production

Result: slow releases, broken deploys, no rollback, manual everything.

With CI/CD — Automated PipelineFast

1. git push → pipeline triggers

every commit tested automatically

2. docker build in clean runner

same env as production — always

3. 47 tests + coverage gate

bugs caught in minutes, not weeks

4. docker push → versioned image

immutable artifact, rollback in <30s

5. kubectl apply → health check ✓

zero-downtime, auditable, repeatable

Result: deploy 10× per day with confidence. Problems auto-rollback.

The Four Pipeline Stages
📝Code

git checkout

npm ci

lint + format

🔨Build

npm run build

docker build

tag image

🧪Test

npm test

coverage gate

security scan

🚀Deploy

docker push

kubectl apply

health check

Interactive Pipeline Simulator

📝

Code

waiting

🔨

Build

waiting

🧪

Test

waiting

🚀

Deploy

waiting

pipeline log

Click ▶ Run Pipeline to start.

Interview Q&A Curriculum

35 questions

Concept Reference

CI — Continuous IntegrationBasics

Merge code frequently; every commit automatically triggers a build + test run so integration bugs are caught within minutes.

CD — Continuous DeliveryBasics

Keep the codebase always in a deployable state; release to production is a deliberate, one-click manual action.

CD — Continuous DeploymentBasics

Every commit that passes all automated tests is deployed to production automatically — no human approval required.

PipelineBasics

Ordered sequence of automated stages: Source → Build → Test → Artifact → Deploy, triggered by a code event.

ArtifactBasics

Versioned build output (Docker image, binary, bundle) stored in a registry and consumed by downstream deployment stages.

Runner / AgentBasics

Machine (GitHub-hosted VM or self-hosted server) that executes pipeline jobs in an isolated environment.

TriggerPipeline

Event that starts a pipeline: push, pull_request, schedule, workflow_dispatch (manual), or completion of an upstream job.

Stage / JobPipeline

Logical unit of pipeline work. Jobs in the same stage run in parallel; sequential stages require the previous stage to pass first.

CachePipeline

Store node_modules, build outputs, or test results between runs so unchanged dependencies are not reinstalled from scratch.

Matrix StrategyPipeline

Run the same job across multiple variable combinations (OS × runtime version) in parallel — great for cross-platform compatibility tests.

EnvironmentPipeline

Named deployment target (dev, staging, production) with its own scoped secrets, protection rules, and required reviewers.

Approval GatePipeline

A manual review step that pauses the pipeline until a designated team member approves before the job proceeds to production.

on: push / pull_requestActions

Workflow event triggers. Runs the pipeline on every code push or when a PR is opened, synchronised, or reopened.

runs-on: ubuntu-latestActions

Specify the runner OS for a job. Options: ubuntu-latest, windows-latest, macos-latest, or a self-hosted label.

uses: actions/checkout@v4Actions

Reusable action that checks out repository code onto the runner. Almost every CI job starts with this step.

needs: [build]Actions

Declare a job dependency — this job will only start after the listed jobs pass successfully, creating a sequential pipeline.

secrets.MY_TOKENActions

Access an encrypted repository or environment secret at runtime. Secret values are automatically masked in all log output.

env: / with:Actions

Pass environment variables (env:) or action input parameters (with:) to a job, step, or reusable action.

workflow_dispatchActions

Allow manual one-click workflow triggering from the GitHub UI with optional typed input parameters.

docker build -t $TAG .Docker

Build a Docker image from the Dockerfile in the current directory and tag it with a unique commit SHA for traceability.

docker push $REGISTRY/$TAGDocker

Push the built and tested image to a container registry (DockerHub, ECR, GCR) for use by deployment stages downstream.

--cache-from $IMAGEDocker

Pull the previous image from the registry and reuse its unchanged layers to dramatically speed up the docker build step.

Multi-stage buildDocker

Builder stage: installs all dev tools + compiles. Final stage: copies only the built output into a minimal base — tiny production image.

trivy image $TAGDocker

Scan the built image for known CVEs before pushing to the registry. Fail the pipeline on CRITICAL severity findings.

npm test -- --coverageTesting

Run the test suite and generate a code coverage report. Fail the pipeline if coverage drops below the configured threshold.

Coverage threshold gateTesting

Enforce a minimum coverage % (e.g. 80%) as a pipeline quality gate — PRs that reduce coverage below the threshold are blocked.

Parallel test shardingTesting

Split the test suite across multiple runners (matrix shards) to run all tests in parallel and reduce total pipeline time.

Smoke testTesting

Minimal post-deploy sanity check (e.g. curl /healthz) run immediately after deployment to verify the service started correctly.

Blue-green deploymentDeploy

Run two identical environments; switch all traffic instantly between them — zero downtime and instant rollback with a single config change.

Canary deploymentDeploy

Route 5–10% of traffic to the new version, monitor error rates, then gradually expand rollout — or rollback if metrics degrade.

Rolling updateDeploy

Replace old instances one-by-one with the new version so two versions run briefly in parallel — requires backward-compatible APIs.

kubectl apply -f k8s/Deploy

Apply Kubernetes manifest files to deploy or update workloads. The core CD command in Kubernetes-based pipelines.

helm upgrade --installDeploy

Deploy or upgrade a Helm chart release. --install creates it if absent, making the command idempotent for first-run pipelines.

kubectl rollout undoDeploy

Roll back a Kubernetes Deployment to the previous ReplicaSet revision — fastest recovery when a bad deploy is detected.

Health check probeDeploy

HTTP/TCP liveness and readiness probes that must pass before a pod receives traffic — automated gate against broken deploys.