惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

大猫的无限游戏
大猫的无限游戏
U
Unit 42
T
Tailwind CSS Blog
罗磊的独立博客
WordPress大学
WordPress大学
小众软件
小众软件
Recent Announcements
Recent Announcements
博客园 - 聂微东
Jina AI
Jina AI
云风的 BLOG
云风的 BLOG
博客园 - 【当耐特】
爱范儿
爱范儿
Microsoft Azure Blog
Microsoft Azure Blog
GbyAI
GbyAI
V
V2EX
博客园 - 三生石上(FineUI控件)
I
InfoQ
雷峰网
雷峰网
G
Google Developers Blog
阮一峰的网络日志
阮一峰的网络日志
B
Blog
腾讯CDC
A
About on SuperTechFans
博客园 - 叶小钗

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
CI/CD for Modern Applications: From Manual Deployments to...
Damir Karimov · 2026-06-15 · via DEV Community

Last year my team had a production incident because someone manually deployed without running tests. The fix took 47 minutes. That's when I realized: CI/CD isn't about automation — it's about controlling risk in software delivery.

In this article, you'll learn how to design reliable pipelines for frontend (React/Next.js) and backend systems, including:

  • Artifact strategies and reproducible builds
  • Testing pyramid (unit, integration, contract, e2e)
  • Safe database migrations
  • Production observability and DORA metrics

Plus: a production checklist you can use immediately.


Modern application development is constrained less by coding speed and more by delivery reliability. Teams can ship features quickly, but production stability breaks when deployments remain manual or partially automated. CI/CD solves this by turning software delivery into a deterministic, repeatable pipeline.

What CI/CD Actually Solves

CI/CD (Continuous Integration and Continuous Delivery/Deployment) is not a toolset — it is a system design approach for software delivery.

Core problems it addresses

Problem Impact
Integration conflicts in branches Merge hell, delayed releases
Unpredictable release cycles Business uncertainty, missed SLAs
Manual deployment errors Production incidents, data corruption
Environment drift "Works in CI, fails in prod"
Slow rollback processes Extended MTTR, higher user impact

Goal: Not "faster deploys", but "reliable, repeatable deploys".


CI: Continuous Integration as a Validation Layer

Continuous Integration ensures every change is validated in a controlled pipeline before merging.

A minimal CI pipeline includes:

  • Linting (code quality enforcement)
  • Unit tests
  • Type checking (TypeScript, etc.)
  • Build verification

Example flow:

feature branch → PR → CI pipeline → checks pass → merge to main

Key principle: Every commit must result in a deployable artifact after CI. Without this rule, CI becomes cosmetic.


CD: Continuous Delivery vs Continuous Deployment

These terms are often mixed but differ structurally:

Aspect Continuous Delivery Continuous Deployment
Build state Always deployable Always deployable
Deployment trigger Manual (human approval) Automatic (after CI success)
Release decision Controlled (gates, approvals) Fully automated
Best for Regulated/large systems Fast-moving products with strong test coverage

CD controls to include:

  • Approval gates
  • Feature flags
  • RBAC & audit trails
  • Environment-specific configuration (not baked into artifacts)

Typical CI/CD Architecture

A production-grade pipeline includes:

Code → CI → Build artifact → Store → Deploy → Monitor

Components

Layer Examples
Source control GitHub, GitLab
CI runner GitHub Actions, GitLab CI, Jenkins
Build system Docker, native builds
Artifact storage Docker registry, S3, artifact repo
Deployment system Kubernetes, Vercel, ECS
Monitoring Logs, metrics (Prometheus), traces (Jaeger)

Pipeline Stages in Modern Apps

A realistic pipeline is layered validation, not linear "test → build → deploy".

1. Pre-merge checks (on PR)

  • ESLint / Prettier
  • TypeScript compilation
  • Unit tests
  • Target: < 10 minutes

2. Post-merge CI

  • Full test suite
  • Integration tests
  • Security scanning (SAST)
  • Target: < 30 minutes

3. Build stage

  • Docker image build
  • Dependency locking
  • Artifact versioning (semver + git SHA)

4. Deployment stage

  • Staging rollout
  • Smoke tests
  • Production deployment (manual or automatic)

5. Post-deployment validation

  • Health checks
  • Observability signals (logs, metrics, traces)

Pipeline Internals: Artifacts, Provenance, Reproducibility

Artifact Strategy

  • Store immutable artifacts: Docker images, frontend build bundles, npm tarballs
  • Tag by semver + git SHA, store digest
  • Deploy by digest (not tag) to ensure consistency

Reproducible Builds

  • Use Docker images with pinned base versions
  • Lock dependency versions (package-lock.json, pnpm-lock.yaml)
  • Deterministic builds (no random timestamps)

Caching & Parallelization

  • Cache node_modules / pnpm store
  • Parallelize test suites
  • Incremental builds (Next.js, TypeScript)

Testing Strategy: The Pyramid

Test Type When to Run Purpose
Unit tests Pre-merge (PR) Fast feedback on logic
Integration Post-merge API, DB, service interactions
Contract tests Post-merge Cross-service compatibility
E2e tests Staging/Nightly Full user flow validation
Performance Nightly Latency, throughput baselines

Flaky tests:

  • Measure flakiness rate (target < 1–2%)
  • Quarantine flaky tests (separate suite)
  • Retry vs fix: fix critical flakies, quarantine low-priority

CI/CD in Frontend-heavy Systems (React / Next.js)

Typical Pipeline

  1. Install dependencies (cached)
  2. Lint + TypeScript check
  3. Unit tests (Jest / Vitest)
  4. Build (Next.js build)
  5. Static analysis (bundle size, unused deps)
  6. Deploy (Vercel / Docker / CDN)

Key Optimizations

  • Cache node_modules / pnpm store
  • Incremental builds
  • Split preview deployments per PR

CI/CD for Scalable Backend Systems

Backend Pipeline Requirements

  • Database migration strategy
  • Backward compatibility checks
  • Blue-green or canary deployments
  • Queue compatibility (Kafka / RabbitMQ)

Deployment Models

Model Use Case Risk
Rolling Simple services Medium
Blue-green Critical services, fast rollback Low
Canary Gradual traffic shift, metrics Low

Safe Database Migrations in CI/CD

Migration Checklist

  1. Add column nullable
  2. Deploy service with backward-compatible code (read new column with fallback)
  3. Run backfill job
  4. Make column non-nullable
  5. Deploy service using new column without fallback
  6. Clean up old code/columns

Orchestration:

  • Migration step in pipeline
  • Feature flag to enable new behavior
  • Health gate: error rate < 0.5%, latency P95 stable

Security in CI/CD

Modern pipelines must include:

  • Dependency scanning (npm audit, Snyk)
  • Secret detection
  • Container vulnerability scanning
  • Signed artifacts (supply chain security)
  • SBOM (Software Bill of Materials)

CI/CD without security gates becomes an attack surface.


Observability as Final Stage of CI/CD

Delivery is incomplete without feedback loop:

  • Logs (structured logging)
  • Metrics (latency, error rate)
  • Traces (request flow)
  • Alerting (SLA violations)

Key Pipeline & Production Metrics (DORA)

Metric Target
Lead time for changes < 1 day
Deployment frequency Daily or on-demand
Change failure rate < 5%
MTTR (Mean Time to Restore) < 1 hour
Flaky-test rate < 1–2%

CI/CD ends where production behavior becomes visible.


Common Failure Points in CI/CD Systems

Most failures are due to design flaws, not tools:

Failure Point Risk
No clear artifact strategy Inconsistent production builds
Missing rollback strategy Increased risk, extended MTTR
Overloaded pipelines Slow feedback, reduced developer productivity
Lack of environment parity "Works in CI, fails in prod"

Rollback should be: Version switch (traffic to previous artifact digest) — NOT manual hotfix process


Production Checklist

Before promoting to production:

✅ Artifact immutable and signed

✅ DB migration safe (nullable → backfill → non-nullable)

✅ Feature flag ready for gradual enable

✅ Health gates configured (error rate, latency)

✅ Monitoring dashboards updated (deploy events visible)

✅ Rollback plan tested (traffic switch < 5 min)


Conclusion

CI/CD is not automation of deployment. It is a system for controlling risk in software delivery.

A well-designed pipeline ensures:

  • Predictable releases
  • Consistent environments
  • Fast feedback loops
  • Safe iteration speed

Teams that implement CI/CD correctly shift from "deploying code" to "managing delivery systems".