This page is part of the ForgeSDLC knowledge base — an AI-assisted, human-directed methodology for taking product work from concept to production. For the core operating model and vocabulary, see Forge SDLC overview and What is ForgeSDLC?.
CI/CD automates the path from code change to production-ready software. Treating the pipeline as a product reduces risk, shortens feedback loops, and makes delivery measurable. This guide is project-agnostic; it describes patterns, gates, and metrics teams use regardless of vendor.
1. CI vs CD: naming and scope
The acronym CD is overloaded. Distinguish continuous delivery (software is always releasable, release may be manual) from continuous deployment (every passing change automatically reaches production).
Term
Meaning
Human gate?
Typical outcome
CI (Continuous Integration)
Frequent integration to mainline with automated build and test
No for merge; yes for code review
Main branch stays green; fast feedback on defects
CD (Continuous Delivery)
Pipeline produces deployable artifacts; deployment to prod is a business decision
Often yes (approve release)
Any commit could go live; release is low ceremony
CD (Continuous Deployment)
Automated promotion to production when quality gates pass
No for routine deploys (policy encodes gates)
Highest automation; requires strong tests and observability
Mnemonic:Delivery = “we can ship”; Deployment = “we do ship” when the pipeline says so.
2. Reference pipeline (conceptual)
The following flow is a composite pattern; teams omit or reorder stages by risk profile and regulatory context.
flowchart LR
A[Commit] --> B[Build]
B --> C[Unit tests]
C --> D[SAST]
D --> E[Integration tests]
E --> F[Deploy to staging]
F --> G[E2E tests]
G --> H{Approval gate}
H -->|Approved / policy| I[Deploy to production]
I --> J[Smoke tests]
J --> K[Monitoring & alerts]
Notes: SAST may run in parallel with unit tests; “approval gate” may be a manual change ticket, policy-as-code, or fully automated in continuous deployment setups.
3. CI practices
Practice
Description
Benefit
Trunk-based development
Small, frequent merges to main; short-lived branches
Reduces merge pain; keeps integration feedback fast
Feature flags
Decouple deploy from release; toggle behavior without new deploy
Safe incremental rollout; supports CD and experiments
Branch by abstraction
Introduce large changes behind an abstraction on main
Avoids long-lived feature branches
Build caching
Cache dependencies, layers, compiler outputs
Cuts pipeline time and cost
Test parallelization
Shard tests across workers
Scales feedback with codebase size
Artifact versioning
Immutable, content-addressed or semver-tagged artifacts
Reproducible deploys and rollbacks
4. CD practices (deployment and release)
Practice
Description
When it fits
Blue-green
Two identical environments; switch traffic atomically
Need fast rollback; can afford duplicate capacity
Canary
Route small % of traffic to new version; expand if healthy
Gradual risk reduction; strong metrics required
Rolling updates
Replace instances incrementally
Common default in orchestrators; balances speed and capacity
Feature flags
Control user-visible features independently of binary version
Experimentation; kill switches
Dark launches
Ship code inert in production; enable later
Validate operational behavior before user impact
A/B deployment
Different versions for cohorts; measure outcomes
Product experimentation; needs routing and analytics
5. Pipeline design patterns
Pattern
Description
Example use
Fan-in
Multiple upstream jobs feed one downstream stage
Combine artifacts from several packages before deploy
Fan-out
One trigger runs many parallel jobs
Matrix across OS, language versions, regions
Matrix builds
Same workflow, different dimensions
Node 18/20 × Linux/macOS
Monorepo pipelines
Selective builds via change detection
Only test affected packages in a large repo
Multi-environment promotion
Dev → staging → prod with same artifact
Immutable artifact promoted; config per environment