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
- Terraform
- API
Properties
CEL expression to match upstream deployment(s) that must have a successful
release before this deployment can proceed.
How It Works
- Release created - A new version is released for a deployment with dependency rules.
- Dependency check - Ctrlplane evaluates the
dependsOnCEL expression to find matching upstream deployments. - Same-resource resolution - For each matching upstream deployment, Ctrlplane looks for a release target on the same resource as the current target. This means the dependency is resolved per-resource, not globally.
- Status evaluation - Each upstream release target must have a latest completed job with a successful status.
- Deployment allowed - Once all upstream dependencies are satisfied, the deployment can proceed.
Common Patterns
Database Before API
Ensure database migrations complete before API deploys:- Terraform
- API
Service Dependency Chain
Create a chain of dependencies:- Terraform
- API
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 using CELin operator:
Combining with Other Rules
With Environment Progression
- Terraform
- API
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 CEL expression matches the expected deployment
- Remember that dependencies are resolved per-resource — the upstream deployment must have a successful release on the same resource
- 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