CodeOath
← All posts
CI/CD & DevOps60 min total · 17 parts

CI/CD Pipelines Explained: From git push to Production

Contents — Part 14 of 17: Feature Flags: Decoupling Deploy from Release
Part 14 of 17 · ~1 min

Feature Flags: Decoupling Deploy from Release

A feature flag (or feature toggle) is a runtime switch that turns a piece of functionality on or off without a new deployment — the code for a feature can be deployed to production, dark, and enabled later (for a specific percentage of users, a specific customer, or everyone at once) with a configuration change instead of a code change.

if (featureFlags.isEnabled("new-checkout-flow", { userId: user.id })) {
  return renderNewCheckout();
}
return renderLegacyCheckout();

This separates two concerns that "deploy" conflates by default: deploying code (getting it running in production, but not necessarily active) and releasing a feature (actually turning it on for users). The practical benefit shows up during an incident — if a newly released feature is causing problems, flipping its flag off is instant and doesn't require a rollback, a new build, or a pipeline run at all; the code causing trouble simply stops executing for anyone. Feature flags also enable gradual/canary-style feature rollouts independent of infrastructure-level canary deploys — a fully rolled-out deployment can still expose a feature to just 5% of users while it's being validated.