add support for build machines

This commit is contained in:
Jörg Thalheim
2024-02-06 16:11:55 +01:00
parent 5e5077c31c
commit 8f74f257e7
3 changed files with 24 additions and 21 deletions

View File

@@ -97,6 +97,23 @@ class Machine:
self.name, self.target_host_address, meta={"machine": self}
)
@property
def build_host(self) -> Host:
"""
The host where the machine is built and deployed from.
Can be the same as the target host.
"""
build_host = self.deployment_info.get("buildHost")
if build_host is None:
return self.target_host
# enable ssh agent forwarding to allow the build host to access the target host
return parse_deployment_address(
self.name,
build_host,
forward_agent=True,
meta={"machine": self, "target_host": self.target_host},
)
def eval_nix(self, attr: str, refresh: bool = False) -> str:
"""
eval a nix attribute of the machine