Overview
Why Use Deployment Dependencies?
Deployment dependency rules help you:- Coordinate services - Deploy database before API, API before frontend
- Manage infrastructure - Infrastructure changes before application updates
- Enforce order - Shared libraries before dependent services
- Reduce failures - Prevent cascading failures from out-of-order deploys
Configuration
Add a deployment dependency rule to your policy:Properties
| Property | Type | Required | Description |
|---|---|---|---|
dependsOnDeploymentSelector | Selector | Yes | Selector for the prerequisite deployment(s) |
reference | string | No | Reference to the dependency entity |
Common Patterns
Database Before API
Ensure database migrations complete before API deploys:Service Dependency Chain
Create a chain of dependencies:Shared Library Dependencies
Ensure shared libraries are deployed before dependent services:Infrastructure First
Deploy infrastructure changes before application updates:Multi-Service Dependency
Depend on multiple services:By Team or Domain
Dependencies based on metadata:Dependency Resolution
1. Release Created
A new version is released for a deployment with dependency rules.2. Dependency Check
Ctrlplane identifies all deployments matchingdependsOnDeploymentSelector.
3. Status Evaluation
For each dependency, Ctrlplane checks if the same version (or compatible version) has been successfully deployed.4. Deployment Allowed
Once all dependencies are satisfied, the deployment can proceed.Combining with Other Rules
With Environment Progression
With Gradual Rollout
Best Practices
Dependency Design
| Pattern | Use Case |
|---|---|
| Database → API | Schema changes before code |
| API → Frontend | API contracts before consumers |
| Infrastructure → App | Platform changes before workloads |
| Shared lib → Services | Common code before dependents |
| Config → Application | Configuration before apps |
Recommendations
- ✅ Keep dependency chains short (2-3 levels max)
- ✅ Use metadata to group related deployments
- ✅ Document why dependencies exist
- ✅ Test dependency resolution in staging
- ✅ Monitor for circular dependency issues
Anti-Patterns
- ❌ Deep dependency chains (> 3 levels)
- ❌ Circular dependencies (A → B → A)
- ❌ Over-coupling unrelated services
- ❌ Using dependencies when environment progression would suffice
Troubleshooting
Deployment Blocked
If a deployment is blocked waiting for dependencies:- Check the dependency deployment’s status
- Verify the selector matches the expected deployment
- Ensure the dependency version is compatible
- Review the dependency deployment’s success status
Circular Dependencies
If you encounter circular dependency errors:- Review the dependency graph
- Break the cycle by removing one dependency
- Consider using environment progression instead
Next Steps
- Policies Overview - Learn about policy structure
- Environment Progression - Cross-environment gates
- Gradual Rollouts - Control deployment pace