What are feature flags and how do they integrate with CI/CD?

Answer

Feature flags (also called feature toggles) are configuration values that enable or disable functionality at runtime without a code deployment. They decouple deployment (shipping code to production) from release (enabling the feature for users). In a CI/CD context, developers merge incomplete features to main behind a disabled flag, enabling trunk-based development without breaking production. When the feature is ready, it is released by flipping the flag — often to a subset of users first (canary-style release). If problems occur, the flag is immediately turned off. Platforms like LaunchDarkly and Unleash provide targeting rules (release to 10% of users, to specific user segments, or to specific accounts). Feature flags also enable A/B testing, kill switches for problematic features, and operational toggles for debugging production issues without a deployment.