So we have a scenario where there's two build plans:
Build leases a host and runs a set of commands in the leased directory. Deploy leases a host, does Run Build Plan to start "Build" and then attempts to deploy the built code.
The problem is that they get different leased directories, because they both do lease host. But there's no way to run "Build" and pass the lease through to "Deploy", which prevents it from working the right way.
We could have a stronger version of "Run Build Plan" called "Embed Build Plan" or something of that nature, which actually takes the steps from the other build plan and runs them in context, but then we'd also need to update the UI to traverse artifacts across "Embed Build Plan" steps so we can show the appropriate output artifacts from "Embed Build Plan" and so we don't raise warnings about artifacts coming from embedded build plans.
At the moment we are just duplicating the steps from Build into Deploy, but this isn't sustainable because when we need to change the build we have to change both build plans.