Environment Promotion Strategy
What you'll learn: How to safely move your software artifacts through a series of environments—from development to production—with the right configurations for each stage.
The Core Idea
An environment promotion strategy defines the path your build artifact takes as it moves from one environment to the next. Think of it like a relay race: the same baton (your artifact) gets passed through different runners (environments), each with their own track conditions (configurations).
Typically, you'll have:
- Development – where features are actively coded and first tested
- Staging (or QA/Pre-Production) – a production-like environment for final validation
- Production – where real users interact with your software
The key principle: build once, deploy many times. You create your artifact (JAR, Docker image, executable) in one pipeline stage, then promote that exact same artifact through each environment. What changes are the configurations—database URLs, API keys, feature flags—not the code itself.
Why This Matters
Promoting the same artifact eliminates the "works on my machine" problem. If you rebuild for each environment, you risk introducing subtle differences. By promoting a single artifact with environment-specific configs, you gain confidence that what passed testing in staging will behave identically in production.
Environment-Specific Configurations
Each environment needs its own settings. Common approaches:
- Configuration files per environment (
config.dev.yaml,config.prod.yaml) - Environment variables injected at deployment time
- Configuration management tools that inject secrets and settings
Your deployment pipeline orchestrates this: it takes the artifact and the appropriate config, then deploys them together.
Key Takeaway: Promote the same artifact across all environments, changing only the environment-specific configurations—ensuring consistency and reducing deployment risk.