Dependencies & Links
A dependency is a slot a bundle declares under dependencies in its massdriver.yaml: a resource type it needs from another bundle. A slot is filled in one of three ways:
- Link: a line drawn on the project canvas from one component's output to another component's input. In each environment, a link is realized as a connection between the two instances.
- Environment default: a resource the environment supplies to every instance that depends on its type.
- Remote reference: a per-instance override that points the slot at a resource from another project or an imported resource. It takes priority over a link or environment default. Set it with
mass instance remote-reference set.
Links were previously called connections in the UI and docs. In the v2 API,
Linkis the blueprint edge between components andConnectionis its realization between instances.
Links are directed. They flow from left to right and form a directed acyclic graph of your infrastructure and applications.
A dotted line means the source resource has not been provisioned yet. A solid line means it has.
Version ranges on a link​
A link is drawn once on the project blueprint, but environments can run different bundle versions. Each link records a version range for the source component and one for the destination component.
A link applies in an environment only when the bundle versions there satisfy both ranges.
How the ranges are set​
You do not type the ranges. When you draw a link, Massdriver reads the bundle version at each end and stores that version's compatibility boundary:
| Deployed version | Stored range | Reason |
|---|---|---|
1.2.3 | ~1 | For 1.0.0 and above, the major version is the compatibility boundary |
2.0.0 | ~2 | A new major version is a new contract |
0.4.1 | ~0.4 | Below 1.0.0, the minor version is the compatibility boundary |
1.2.3-dev.20060102T150405Z | ~1 | A development release shares its base version's boundary |
A development release satisfies the same range as the version it is based on, so a link stays wired while you test a -dev build.
A 0.x bundle changes its compatibility boundary on every minor bump. A component moving from 0.4.1 to 0.5.0 leaves the ~0.4 range, and the link drawn at 0.4.1 no longer applies to it. Draw the link again at the new version, or publish 1.0.0 so the boundary widens to the major version.
More than one link on the same field​
A destination field can carry several links, as long as no two of them could apply at the same time. Massdriver rejects a new link when its source range and its destination range both overlap an existing link on that field, because a single pair of deployed versions would then satisfy two at once.
Non-overlapping pairs are what make a staged rollout work. A field can hold vpc ~1 → db ~1 and vpc ~1 → db ~2 together. Every environment satisfies exactly one of them, so staging moves to the new major version on its own schedule and production keeps the wiring it already had.
Seeing what an instance is bound to​
Open an instance and select the Dependencies tab. Each row shows the resource type and the version range the slot accepts, and the instance currently filling it. The Resources tab lists what the instance produces and who consumes it.
Params from dependencies​
The $md.enum annotation turns a param into a dropdown whose options come from a dependency's data. A bundle that depends on a VPC can offer its subnets, and one that depends on a database cluster can offer its databases.
Removing a link​
Click the X at the middle of the line (Delete link), or run mass component unlink.
Removing a link without decommissioning the dependent component can leave an inconsistent state and orphaned resources.
Related documentation​
- Version resolution — how a dependency's version range picks a resource at deploy time
- Bundle YAML: dependencies — declaring what a bundle consumes